<?php function wp_auto_spinner_settings()
{?>

<?php

    $itm_prefix = 'wp_auto_spinner';
    $itm_id = 4092452;

    $proxify = true;

    
    $license_active = get_option($itm_prefix . '_license_active', '');
    $wp_auto_spinner_license = trim(get_option('wp_auto_spinner_license', ''));

    if(isset ($_POST['wp_auto_spinner_license'])) 
        $is_new_license_than_saved = $wp_auto_spinner_license != trim($_POST['wp_auto_spinner_license']);

    //purchase check
    if (isset($_POST[$itm_prefix . '_license']) && ( trim($license_active) === '' || $is_new_license_than_saved  )   ) {
 
       


        //save it
        update_option($itm_prefix . '_license', $_POST[$itm_prefix . '_license']);

        //activating
        //curl ini
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
        curl_setopt($ch, CURLOPT_TIMEOUT, 20);
        curl_setopt($ch, CURLOPT_REFERER, 'http://www.bing.com/');
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8');
        curl_setopt($ch, CURLOPT_MAXREDIRS, 5); // Good leeway for redirections.
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Many login forms redirect at least once.

        //curl get
        $x = 'error';

        //change domain ?
        $append = '';

        if (isset($_POST['wp_auto_spin']) && in_array('OPT_CHANGE_DOMAIN', $_POST['wp_auto_spin'])) {
            $append = '&changedomain=yes';
        }

        $url = 'https://deandev.com/license/index.php?itm=' . $itm_id . '&domain=' . $_SERVER['HTTP_HOST'] . '&purchase=' . trim($_POST[$itm_prefix . '_license']) . $append;

        if (WP_VALVE_PROXY) {
            $url = 'http://labnol-proxy-server.appspot.com/' . str_replace('http://', '', $url);
        }

        curl_setopt($ch, CURLOPT_HTTPGET, 1);
        curl_setopt($ch, CURLOPT_URL, trim($url));

        $exec = curl_exec($ch);
        $x = curl_error($ch);

        $resback = $exec;

        if (trim($exec) == '' || !stristr($exec, '{')) {

            $url = 'http://deandev-proxy.appspot.com/license/index.php?itm=' . $itm_id . '&domain=' . $_SERVER['HTTP_HOST'] . '&purchase=' . trim($_POST[$itm_prefix . '_license']) . $append;

            curl_setopt($ch, CURLOPT_HTTPGET, 1);
            curl_setopt($ch, CURLOPT_URL, trim($url));

            $exec = curl_exec($ch);
            $resback = $exec;
            $x = curl_error($ch);
        }

        $resarr = json_decode($resback);

        if (isset($resarr->message)) {
            $license_message = $resarr->message;

            //activate the plugin
            update_option($itm_prefix . '_license_active', 'active');
            update_option($itm_prefix . '_license_active_date', time());
            $license_active = get_option($itm_prefix . '_license_active', '');

        } else {
            if (isset($resarr->error)) {
                $license_error = $resarr->error;

                 //delete license activation 
                delete_option($itm_prefix . '_license_active');

                //reset license active param
                $license_active = '';

            }

        }

    }

    // update options on post
    if (isset($_POST['wp_auto_spinner_lang'])) {

        if (!isset($_POST['wp_auto_spin'])) {
            update_option('wp_auto_spin', array());
        } else {
            update_option('wp_auto_spin', $_POST['wp_auto_spin']);
        }

        if (!isset($_POST['wp_spinner_types'])) {
            update_option('wp_spinner_types', array(
                'post',
            ));
        } else {
            update_option('wp_spinner_types', $_POST['wp_spinner_types']);
        }

        if (!isset($_POST['post_category'])) {
            update_option('wp_auto_spin_execl', array());
        } else {
            update_option('wp_auto_spin_execl', $_POST['post_category']);
        }

        update_option('wp_auto_spinner_lang', $_POST['wp_auto_spinner_lang']);
        update_option('wp_auto_spinner_execlude', $_POST['wp_auto_spinner_execlude']);
        update_option('wp_auto_spinner_email', $_POST['wp_auto_spinner_email']);
        update_option('wp_auto_spinner_password', $_POST['wp_auto_spinner_password']);
        update_option('wp_auto_spinner_quality', $_POST['wp_auto_spinner_quality']);
        //update_option ( 'wp_auto_spinner_license', $_POST ['wp_auto_spinner_license'] );

        //wordai
        $fieldsToUpdate = array(

            'wp_auto_spinner_wordai_email',
            'wp_auto_spinner_wordai_password',
            'wp_auto_spinner_wordai_uniqueness',

            'wp_auto_spinner_tbs_email',
            'wp_auto_spinner_tbs_password',
            'wp_auto_spinner_tbs_quality',
            'wp_auto_spinner_tbs_maxsyns',

            'wp_auto_spinner_cp_email',
            'wp_auto_spinner_cp_password',
            'wp_auto_spinner_cp_type',
            'wp_auto_spinner_cp_language',
            'wp_auto_spinner_cp_limit',
            'wp_auto_spinner_cp_quality',
            'wp_auto_spinner_cp_synonym_set',
            'wp_auto_spinner_cp_min_words_count',
            'wp_auto_spinner_cp_max_words_count',

            

            'wp_auto_spinner_cr_email',
            'wp_auto_spinner_cr_apikey',
            'wp_auto_spinner_cr_quality',
            'wp_auto_spinner_cr_phrasequality',
            'wp_auto_spinner_cr_posmatch',

            'wp_auto_spinner_es_email',
            'wp_auto_spinner_es_password',

            'wp_auto_spinner_bot_key',
            
            'wp_auto_spinner_rp_key',
            'wp_auto_spinner_rp_lang',

			'wp_auto_spinner_openai_api_key',
            'wp_auto_spinner_wordai_method',
            'wp_auto_spinner_wordai_mode'
            

        );

        //updating
        foreach ($fieldsToUpdate as $fieldToUpdate) {
            update_option($fieldToUpdate, $_POST[$fieldToUpdate]);
        }

        //generic update to update any field starting with wp_auto_spinner_ if not in the above array
        foreach ($_POST as $key => $value) {
            if (strpos($key, 'wp_auto_spinner_') !== false) {
                if (!in_array($key, $fieldsToUpdate)) {
                    update_option($key, $value);
                }
            }
        }

        echo '<div class="updated" id="message"><p>Plugin settings <strong>updated successfully</strong>. </p></div>';
    }

    // data
    $wp_auto_spinner_lang = get_option('wp_auto_spinner_lang', 'en');
    $wp_auto_spinner_execlude = get_option('wp_auto_spinner_execlude', '');
    $wp_auto_spinner_email = get_option('wp_auto_spinner_email', '');
    $wp_auto_spinner_password = get_option('wp_auto_spinner_password', '');
    $wp_auto_spinner_quality = get_option('wp_auto_spinner_quality', 'medium');
    $queue_url = admin_url('admin.php?page=wp_auto_spinner_queue');

    // wordai
    $wp_auto_spinner_wordai_email = get_option('wp_auto_spinner_wordai_email', '');
    $wp_auto_spinner_wordai_password = get_option('wp_auto_spinner_wordai_password', '');
    $wp_auto_spinner_wordai_uniqueness = get_option('wp_auto_spinner_wordai_uniqueness', '1');
    $wp_auto_spinner_wordai_method = get_option('wp_auto_spinner_wordai_method', 'rewrite');
    $wp_auto_spinner_wordai_mode = get_option('wp_auto_spinner_wordai_mode', 'change_more');

	//openai
	$wp_auto_spinner_openai_api_key = get_option('wp_auto_spinner_openai_api_key', '');

    //tbs
    $wp_auto_spinner_tbs_email = get_option('wp_auto_spinner_tbs_email', '');
    $wp_auto_spinner_tbs_password = get_option('wp_auto_spinner_tbs_password', '');
    $wp_auto_spinner_tbs_maxsyns = get_option('wp_auto_spinner_tbs_maxsyns', '');
    $wp_auto_spinner_tbs_quality = get_option('wp_auto_spinner_tbs_quality', '');

    //contentprofessor
    $wp_auto_spinner_cp_email = get_option('wp_auto_spinner_cp_email', '');
    $wp_auto_spinner_cp_password = get_option('wp_auto_spinner_cp_password', '');
    $wp_auto_spinner_cp_language = get_option('wp_auto_spinner_cp_language', 'en');
    $wp_auto_spinner_cp_limit = get_option('wp_auto_spinner_cp_limit', '5');
    $wp_auto_spinner_cp_quality = get_option('wp_auto_spinner_cp_quality', 'ideal');
    $wp_auto_spinner_cp_synonym_set = get_option('wp_auto_spinner_cp_synonym_set', 'global');
    $wp_auto_spinner_cp_min_words_count = get_option('wp_auto_spinner_cp_min_words_count', '1');
    $wp_auto_spinner_cp_max_words_count = get_option('wp_auto_spinner_cp_max_words_count', '7');
    $wp_auto_spinner_cp_type = get_option('wp_auto_spinner_cp_type', 'free');

    //sc spinnerchief
    $wp_auto_spinner_sc_replacetype = get_option('wp_auto_spinner_sc_replacetype', '0');
    $wp_auto_spinner_sc_wordquality = get_option('wp_auto_spinner_sc_wordquality', '0');
    $wp_auto_spinner_sc_thesaurus = get_option('wp_auto_spinner_sc_thesaurus', 'English');
    $wp_auto_spinner_sc_Wordscount = get_option('wp_auto_spinner_sc_Wordscount', '5');
    $wp_auto_spinner_sc_spinfreq = get_option('wp_auto_spinner_sc_spinfreq', '4');
    $wp_auto_spinner_sc_password = get_option('wp_auto_spinner_sc_password', '');
    $wp_auto_spinner_sc_email = get_option('wp_auto_spinner_sc_email', '');

    //cr chimprewriter
    $wp_auto_spinner_cr_email = get_option('wp_auto_spinner_cr_email', '');
    $wp_auto_spinner_cr_apikey = get_option('wp_auto_spinner_cr_apikey', '');
    $wp_auto_spinner_cr_quality = get_option('wp_auto_spinner_cr_quality', '4');
    $wp_auto_spinner_cr_phrasequality = get_option('wp_auto_spinner_cr_phrasequality', '3');
    $wp_auto_spinner_cr_posmatch = get_option('wp_auto_spinner_cr_posmatch', '3');

    ?>



<div class="wrap">
    <div style="margin-left: 8px" class="icon32" id="icon-options-general">
        <br>
    </div>

    <form method="POST" class="TTWForm-auto-spin">

        <h2>Settings <input type="submit" name="save" value="Save Changes" class="button-primary"></h2>

        <p><strong>Where</strong> you can configure the plugin. Choose your language, spinning method, configure the
            cron & set things up.</p>

        <div id="dashboard-widgets-wrap">

            <div class="metabox-holder columns-1" id="dashboard-widgets">
                <div class="postbox-container" id="postbox-container-1" style="width:100%;max-width:1080px">
                    <div>

                        <?php if (trim($license_active) != '') {?>


                        <div class="postbox">
                            <h2 class="hndle">
                                <span>Basic options</span>
                            </h2>
                            <div class="inside">
                                <!--  insider start -->


                                <table class="form-table">
                                    <tbody>



                                        <tr>
                                            <th scope="row"><label>Thesaurus Language</label></th>
                                            <td>
                                                <select name="wp_auto_spinner_lang" id="field1zz">
                                                    <option value="en"
                                                        <?php opt_selected('en', $wp_auto_spinner_lang)?>>English
                                                    </option>
                                                    <option value="du"
                                                        <?php opt_selected('du', $wp_auto_spinner_lang)?>>Dutch</option>
                                                    <option value="ge"
                                                        <?php opt_selected('ge', $wp_auto_spinner_lang)?>>German
                                                    </option>
                                                    <option value="fr"
                                                        <?php opt_selected('fr', $wp_auto_spinner_lang)?>>French
                                                    </option>
                                                    <option value="it"
                                                        <?php opt_selected('it', $wp_auto_spinner_lang)?>>Italian
                                                    </option>
                                                    <option value="sp"
                                                        <?php opt_selected('sp', $wp_auto_spinner_lang)?>>Spanish
                                                    </option>
                                                    <option value="po"
                                                        <?php opt_selected('po', $wp_auto_spinner_lang)?>>Portuguese
                                                    </option>
                                                    <option value="ro"
                                                        <?php opt_selected('ro', $wp_auto_spinner_lang)?>>Romanian
                                                    </option>
                                                    <option value="tr"
                                                        <?php opt_selected('tr', $wp_auto_spinner_lang)?>>Turkish
                                                    </option>

                                                </select>

                                                <div class="description">Choose which language the plugin will rewrite
                                                    the content in.</div>
                                            </td>
                                        </tr>

                                        <tr>
                                            <th scope="row"><label>Auto spin?</label></th>
                                            <td>
                                                <input name="wp_auto_spin[]" id="field-wp_auto_spin_active-1"
                                                    value="OPT_AUTO_SPIN_ACTIVE" type="checkbox"> Activate
                                                <strong>automatic spining mode</strong> for posts .
                                                <div style="padding-top:5px" class="description">Activate this option to
                                                    spin bots posts automatically. When this option is active, any bot
                                                    post gets added to your WordPress will be sent to the <a
                                                        href="<?php echo $queue_url ?>">spinning queue</a>. Note that
                                                    you should <b>set up the cron job below</b> for the plugin to
                                                    process items that get sent to the <a
                                                        href="<?php echo $queue_url ?>">spinning queue</a>.</div>


                                        </tr>



                                        <tr>
                                            <th scope="row"><label>Spin the title?</label></th>
                                            <td>

                                                <input name="wp_auto_spin[]" id="field-wp_auto_spin_active-1"
                                                    value="OPT_AUTO_SPIN_ACTIVE_TTL" type="checkbox"> When automatically
                                                spinning an article, <strong>rewrite the post title</strong> as well.
                                        </tr>



                                        <tr>
                                            <th scope="row"><label>Don't spin the content?</label></th>
                                            <td>

                                                <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_DEACTIVE_CNT"
                                                    type="checkbox"> Enable this option to deactivate content spinning.
                                                Looks like a weird option but it is suitable if you want to rewrite the
                                                title only.
                                        </tr>

                                        <tr>
                                            <th scope="row"><label>Spin the post slug?</label></th>
                                            <td>

                                                <input name="wp_auto_spin[]" id="field-wp_auto_spin_active-1"
                                                    value="OPT_AUTO_SPIN_SLUG" type="checkbox"> Rewrite the <abbr
                                                    title="Permalink">post slug</abbr>.

                                        </tr>

                                        <tr>
                                            <th scope="row"><label>Spin links anchor text?</label></th>
                                            <td>

                                                <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_LINKS"
                                                    type="checkbox"> When rewriting an article, <strong>spin links
                                                    text</strong> as well.
                                        </tr>

                                        <tr>
                                            <th scope="row"><label>Auto spin manual posts?</label></th>
                                            <td>

                                                <input name="wp_auto_spin[]" id="field-wp_auto_spin_active-1"
                                                    value="OPT_AUTO_SPIN_ACTIVE_MANUAL" type="checkbox"> Automatically
                                                rewrite <abbr
                                                    title="(This will spin the posts you write manually so when you write and preview a post, it will get spinned instantly.)(not recommended)"><strong>manually
                                                        written</strong></abbr> posts.
                                        </tr>

                                        <tr>
                                            <th scope="row"><label>Spin instantly? </label></th>
                                            <td>

                                                <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_PUBLISH"
                                                    type="checkbox">Auto spin instantly <abbr
                                                    title="Fires the spinning process once the post gets published. Regularly it gets added to the spinning queue."><strong>on
                                                        publish</strong></abbr>.
                                                <div style="padding-top:5px" class="description">By default, Bots posts
                                                    get added to the <a href="<?php echo $queue_url ?>">spinning
                                                        queue</a> where the cron do process one post every minute. If
                                                    you want to rewrite them instantly, activate this option.<br>
                                                    Not recommended if you are using OpenAI GPT method as it will take a long time to rewrite the post which may result in timeout. check this tutorial for best config when using the Open AI method <a href="https://valvepress.com/the-best-configuration-for-wordpress-auto-spinner-when-rewriting-using-openai-api/">The best configuration for WordPress Auto Spinner when rewriting using OpenAI API</a>
                                                
                                                
                                                </div>
                                        </tr>

                                        <tr>
                                            <th scope="row"><label>Activate shuffule mode? (Not recommended)</label>
                                            </th>
                                            <td>

                                                <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_ACTIVE_SHUFFLE"
                                                    type="checkbox">Replace <strong>any word</strong> from the synonyms
                                                set by any other word from the same set.

                                                <div class="description">By default, if we have a synonyms set in the
                                                    form "word1|word2|word3" and the content contains the word "word1"
                                                    it will be replaced by either "word2" or "word3". But if the post
                                                    contains the word "word2", it will not be replaced as the plugin
                                                    replaces the first word of the set, not the counter. By activating
                                                    this option, if "word2" or "word3" exists in the content, they will
                                                    be replaced by "word1" or another word from the set.</div>

                                        </tr>

                                        <tr>
                                            <th scope="row"><label>Spin queued scheduled posts instantly?</label></th>
                                            <td>

                                                <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_SCHEDULED"
                                                    type="checkbox">By default, scheduled posts in the queue get rewritten once
                                                published. Activate this if you don't want them to wait till published.

                                        </tr>

                                        <tr>
                                            <th scope="row"><label>Spin draft posts?</label></th>
                                            <td>

                                                <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_DRAFT"
                                                    type="checkbox">By default, draft posts get spinned once published.
                                                Activate this option if you don't want them to wait till published.

                                        </tr>

                                       
                                        

                                        <tr>
                                            <th scope="row"><label>Change post status to Publish? </label></th>
                                            <td>
                                                <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_STATUS_PUBLISH"
                                                    type="checkbox"> Change the post status to publish after rewriting
                                                <div style="padding-top:5px" class="description">Activate this option to
                                                   change the post status to publish if not already published. Works for auto spin posts and queued posts and not manually rewritten posts by clicking the rewrite button. </div>
                                        </tr>

                                        <!-- checkbox to update post date to the current date after spinning -->
                                        <tr>
                                            <th scope="row"><label>Update post date to current date/time? </label></th>
                                            <td>
                                                <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_UPDATE_DATE"
                                                    type="checkbox"> Update the post date to the current date after rewriting
                                                <div style="padding-top:5px" class="description">Activate this option to
                                                    update the post date to the current date after rewriting. Works for auto spin posts and queued posts and not manually rewritten posts by clicking the rewrite button. </div>
                                        </tr>

                                        <tr>
                                            <th scope="row"><label>Disable the spining queue? </label></th>
                                            <td>
                                                <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_QUEUE_DISABLED"
                                                    type="checkbox"> Disable processing <strong>the spinning
                                                    queue</strong>.
                                                <div style="padding-top:5px" class="description">Activate this option if
                                                    you want to disable the <a href="<?php echo $queue_url ?>">spinning
                                                        queue</a>. The cron will not process any item from the queue.
                                                    <br>(<b>Be carefull,</b> this option will <b>stop spinning items
                                                        from the queue</b>).
                                                </div>


                                        </tr>

                                        <tr>
                                            <th scope="row"><label>Disable internal synonyms? </label></th>
                                            <td>
                                                <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_NO_THESAURUS"
                                                    type="checkbox"> Disable using the plugin synonyms database
                                                <div style="padding-top:5px" class="description">Activate this option to
                                                    disable using the internal plugin synonyms in case you will only use
                                                    your custom added synonyms in the "My Thesaurus" tab. </div>
                                        </tr>


                                    </tbody>
                                </table>


                                <p style="padding-top: 5px">

                                    <input class="button" name="submit" value="Save Settings" type="submit">

                                </p>



                            </div>
                            <!--/TTWForm-contain-->



                            <!-- insider End -->

                        </div>
                    </div>

                    <div class="postbox">
                        <h2 class="hndle">
                            <span>Custom Post Types <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <table class="form-table">
                                <tbody>

                                    <tr>
                                        <th scope="row"><label>Post Types?</label></th>
                                        <td>

                                            <?php

        $ptype = get_post_types(array(), 'names', 'or');
        foreach ($ptype as $type) {
            if (post_type_supports($type, 'editor')) {
                $post_types[] = $type;
            }
        }

        foreach ($post_types as $post_type) {
            ?>



                                            <input name="wp_spinner_types[]" value="<?php echo $post_type ?>"
                                                type="checkbox"> <span class="option-title">
                                                <?php echo $post_type ?>
                                            </span>


                                            <?php
}

        ?>

                                            <div class="description">Choose which post types the plugin will support, so
                                                the plugin will be enabled when editing posts from these post types.
                                            </div>


                                    </tr>

                                </tbody>
                            </table>



                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>


                    <div class="postbox">
                        <h2 class="hndle" id="dashboard-widgets-cron">
                            <span>Cron Job Setup<span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <?php $lastrun = get_option('wp_auto_spinner_last_run', 1392146043);?>

                            <table class="form-table">
                                <tbody>
                                    <tr>
                                        <th scope="row"><label>Internal Cron </label></th>
                                        <td>

                                            <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CRON" type="checkbox">
                                            <span class="option-title"> Use WordPress built-in Cron instead. </span>
                                    </tr>
                                    <tr>
                                        <th scope="row"><label>Cron Status </label></th>
                                        <td>

                                            <p style="margin-top: -13px;"><strong>Current</strong> server time is
                                                <strong>(<?php echo date('h:i:s', current_time('timestamp')) ?>)</strong>,
                                                Cron last run at <strong>(<?php echo date("h:i:s", $lastrun) ?>
                                                    )</strong> this is <strong>
                                                    (<?php echo $timdiff = current_time('timestamp') - $lastrun ?>)</strong>
                                                seconds ago, and it runs every <strong>(60)</strong> seconds to process
                                                one item from the <a href="<?php echo $queue_url ?>">Spinning Queue</a>,
                                                So it should run again after
                                                <strong>(<?php echo (60 - $timdiff) ?>)</strong> seconds.
                                    </tr>

                                    <tr>
                                        <th scope="row"><label>Run Now </label></th>
                                        <td>

                                            <?php $cronurl = site_url('?wp_auto_spinner=cron', __FILE__)?>
                                            ( <a target="blank" href="<?php echo $cronurl ?>">Start now </a>)

                                            <div class="description">Open this link to trigger the cron manually which
                                                will process one item from the <a
                                                    href="<?php echo $queue_url ?>">Spinning Queue</a>.</div>
                                    </tr>

                                    <tr>
                                        <th scope="row"><label>Cron Command </label></th>
                                        <td>

                                            <div
                                                style="background-color: #FFFBCC; border: 1px solid #E6DB55; color: #555555; padding: 5px; width: 97%; margin-top: 10px">

                                                <?php

        echo 'curl ' . $cronurl;
        ?>
                                            </div>
                                            <div class="description">Copy this command to your hosting Crontab. Check <a
                                                    href="http://valvepress.com/wordpress-internal-cron-job-work-may-need-setup-external-cron/"
                                                    target="_blank">this tutorial</a> on why and how to setup The Cron
                                                job</div>

                                            <p>If the above command didn't work for your host, Use the one mentioned
                                                bleow.</p>



                                    </tr>

                                    <?php ?>
                                    <tr>
                                        <th scope="row"><label>Alternate Command</label></th>
                                        <td>

                                            <div
                                                style="background-color: #FFFBCC; border: 1px solid #E6DB55; color: #555555; padding: 5px; width: 97%; margin-top: 10px">
                                                <?php
//$cronpath = dirname ( __FILE__ ) . '/cron.php';
        echo 'wget -O /dev/null  ' . $cronurl;
        ?>
                                            </div>
                                            <div class="description">This is another alternative to the above command,
                                                In case the above one didn't work on your host.</div>
                                    </tr>

                                    <tr>

                                    <th scope="row"><label>TIP</label></th>
                                        <td>

                                            <div>
                                               When you setup the cron job, the plugin will process a single post every minute from the queue, if you want to spin continousely without waiting for this minute, check this tutorial <a href="https://valvepress.com/how-to-rewrite-continousely-on-wordpress-auto-spinner-plugin-without-waiting-for-one-minute/">How to rewrite continousely on WordPress Auto Spinner plugin without waiting for one minute</a>
         
                                            </div>
                                                
                                    
                                    </tr>

                                    <?php ?>

                                </tbody>
                            </table>


                            <p style="padding-top: 5px">
                                <input type="submit" class="button" name="submit" value="Save Settings">
                            </p>


                            <!-- /insider 3 -->
                        </div>
                    </div>



                    <div class="postbox">
                        <h2 class="hndle">
                            <span>Exclusion and protected terms <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <table class="form-table">
                                <tbody>
                                    <tr>
                                        <th scope="row"><label>Exclude title words </label></th>
                                        <td>

                                            <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_TITLE_EX" type="checkbox">
                                            <span class="option-title"> Exclude title words from spinning in the post
                                                content . </span>
                                            <div class="description">Note: Title also will not be spinned if this option
                                                is active.</div>
                                    </tr>

                                    <tr>
                                        <th scope="row"><label>Exclude capitals in post content </label></th>
                                        <td>

                                            <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CAP_EX" type="checkbox">
                                            <span class="option-title"> Exclude words starting with a capital letter.
                                            </span>
                                    </tr>

                                    <tr>
                                        <th scope="row"><label>Exclude capitals in post title</label></th>
                                        <td>

                                            <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CAP_EX_TTL"
                                                type="checkbox"> <span class="option-title"> Exclude words starting with
                                                a capital letter in title. </span>
                                    </tr>

                                    <tr>
                                        <th scope="row"><label>Exclude textual URLs </label></th>
                                        <td>

                                            <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_URL_EX" type="checkbox">
                                            <span class="option-title">Activate this if you want to skip rewriting the
                                                URLs written without the hyperlink HTML tag (i.e., not hyperlinked).
                                            </span>
                                    </tr>

                                    <tr>
                                        <th scope="row"><label>Exclude smart quotes </label></th>
                                        <td>

                                            <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CURLY_EX" type="checkbox">
                                            <span class="option-title">Activating this option will exclude the text
                                                inside single quotes (‘ ’), double quotes (“ ”), and curly quotes.
                                            </span>
                                    </tr>

                                    <tr>
                                        <th scope="row"><label>Exclude regular quotes </label></th>
                                        <td>

                                            <input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CURLY_EX_R"
                                                type="checkbox"> <span class="option-title"> This option will exclude
                                                text inside double quotes (" "). </span>
                                    </tr>



                                    <tr>
                                        <th scope="row"><label>Reserved words </label></th>
                                        <td>

                                            <textarea style="width: 100%" rows="5" cols="20"
                                                name="wp_auto_spinner_execlude"
                                                id="field-wp_auto_spinner_execlude"><?php echo stripslashes($wp_auto_spinner_execlude) ?></textarea>
                                            <div class="description">Words in this box will not be rewritten. Add them
                                                one per line.</div>
                                    </tr>
                                    <tr>
                                        <th scope="row"><label>Excluded categories </label></th>
                                        <td>

                                            <div id="taxonomy-category" class="categorydiv">
                                                <div id="category-all" class="tabs-panel">
                                                    <input type="hidden" name="post_category[]" value="0">
                                                    <ul id="categorychecklist" data-wp-lists="list:category"
                                                        class="categorychecklist form-no-clear">
                                                        <?php wp_category_checklist();?>
                                                    </ul>
                                                </div>

                                            </div>
                                            <div class="description">Posts belonging to these categories will not be
                                                rewritten.</div>
                                    </tr>

                                </tbody>
                            </table>



                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>

                            <!-- /insider 3 -->
                        </div>
                    </div>


                    <div class="postbox spinning_method_wrap">
                        <h2 class="hndle">
                            <span>Spinning method<span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>By default, the plugin uses its private synonyms database, but you still can use any of
                                the six most popular APIs to rewrite the posts.</p>

                            <table class="form-table">


                                <tr>
                                    <th scope="row">Method </td>
                                    <td>

                                        <input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_INTERNAL" type="radio"> <span class="option-title"> Use
                                            built-in synonyms database . </span>
                                        <br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_REWRITER" type="radio"> <span class="option-title"> Use
                                            SpinRewriter.com API </span>
                                        <br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_CR" type="radio"> <span class="option-title"> Use
                                            ChimpRewriter API </span>
                                        <br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_WORDAI" type="radio"> <span class="option-title"> Use
                                            wordai.com API </span>
										<br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_OPENAI" type="radio"> <span class="option-title"> Use
                                            AI API </span>	
                                        <br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_TBS" type="radio"> <span class="option-title"> Use
                                            TheBestSpinner API </span>
                                        <br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_CP" type="radio"> <span class="option-title"> Use
                                            ContentProfessor API </span>
                                        <br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_SC" type="radio"> <span class="option-title"> Use
                                            SpinnerChief API</span>
                                        <br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_BOT" type="radio"> <span class="option-title"> Use
                                            SpinBot API</span>
                                        <br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_RP" type="radio"> <span class="option-title"> Use
                                            smodin.io Rewriter/Paraphraser/Text Changer API</span>
                                        <br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_ES" type="radio"> <span class="option-title"> Use
                                            Espinner.net API (Spanish only). </span>
                                        
                                        <?php /*
                                            <br><input class="spin_method_selector" name="wp_auto_spin[]"
                                            value="OPT_AUTO_SPIN_UAI" type="radio"> <span class="option-title"> Use
                                            <a href="https://undetectable.ai?_by=i2ipc" target="_blank">Undetectable.ai Humanizer</a>
                                                */ ?>
                                    </td>
                                </tr>


                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>



                    <div class="postbox OPT_AUTO_SPIN_REWRITER spin_method_box">
                        <h2 class="hndle">
                            <span>Spin Rewriter (OPTIONAL) <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>Sign up for <a href="http://www.spinrewriter.com/?ref=11ade">SpinRewiter</a> to rewrite
                                the posts using its API. Spin Rewriter actually understands the text and only suggests
                                meaningful synonyms.</p>



                            <table class="form-table">


                                <tr>
                                    <th scope="row">SpinRewriter email </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_email; ?>"
                                            name="wp_auto_spinner_email" id="field-spinner-email" type="text"></td>
                                </tr>

                                <tr>
                                    <th scope="row">SpinRewriter api key </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_password; ?>"
                                            name="wp_auto_spinner_password" id="field-spinner-password" type="password">
                                    </td>
                                </tr>

                                <?php

        if (trim($wp_auto_spinner_email) != '' && trim($wp_auto_spinner_password) != '') {

            require_once "inc/SpinRewriterAPI.php";

            // Authenticate yourself.
            $spinrewriter_api = new wp_auto_spinner_SpinRewriterAPI($wp_auto_spinner_email, $wp_auto_spinner_password);

            // Make the actual API request and save response as a native PHP array.
            $api_response = $spinrewriter_api->getQuota();

            // Output the API response.
            if (isset($api_response['response'])) {
                echo '<tr><th scope="row">Status</th><td>' . $api_response['response'] . '</td></tr>';
            }

        }

        ?>

                                <tr>
                                    <th scope="row">Safe mode? </th>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_SR_SAFE" type="checkbox">
                                        <span class="option-title"> In this mode, the plugin will not trust the returned
                                            content from the service but will only extract the synonyms and will apply
                                            them on the original content. By default, we send the content and recieve it
                                            rewritten but sometimes the service may mess with the content by adding
                                            unwanted content or removing parts of it. This mode makes sure your content
                                            does not get deformed </span>
                                    </td>
                                </tr>
                                <tr>

                                <tr>
                                    <th scope="row">Confidence Level</td>
                                    <td>


                                        <select name="wp_auto_spinner_quality">
                                            <option value="low" <?php opt_selected('low', $wp_auto_spinner_quality)?>>
                                                Low</option>
                                            <option value="medium"
                                                <?php opt_selected('medium', $wp_auto_spinner_quality)?>>Medium</option>
                                            <option value="high" <?php opt_selected('high', $wp_auto_spinner_quality)?>>
                                                High</option>


                                        </select>


                                    </td>
                                </tr>
                                <?php /*
        <tr>
        <th scope="row">Nested Spin  </th>
        <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_NestedSpintax" type="checkbox"> <span class="option-title"> Set whether the One-Click Rewrite process uses nested spinning syntax (multi-level spinning) or not. . </span></td>
        </tr>
         */
        ?>

                                <tr>
                                    <th scope="row">Note </th>
                                    <td><span style="color:red">Important:</span> Activating options below may cause
                                        html layout to break or result in ***** appearing at the content, So use
                                        carefully and if you got html broken,deactivate them. unfortunately html tags
                                        locations may get messed using these options.</td>
                                </tr>

                                <tr>
                                    <th scope="row">Auto Sentences </th>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_AutoSentences"
                                            type="checkbox"> <span class="option-title"> <span style="color:red">[Not
                                                recommended]</span> Set whether Spin Rewriter rewrites complete
                                            sentences on its own. </span></td>
                                </tr>
                                <tr>
                                    <th scope="row">Auto Paragraphs </th>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_AutoParagraphs"
                                            type="checkbox"> <span class="option-title"><span style="color:red">[Not
                                                recommended]</span> Set whether Spin Rewriter rewrites entire paragraphs
                                            on its own. </span></td>
                                </tr>
                                <tr>
                                    <th scope="row">Auto New Paragraphs </th>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_AutoNewParagraphs"
                                            type="checkbox"> <span class="option-title"><span style="color:red">[Not
                                                recommended]</span> Set whether Spin Rewriter writes additional
                                            paragraphs on its own. </span></td>
                                </tr>
                                <tr>
                                    <th scope="row">Auto Sentence Trees</th>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_AutoSentenceTrees"
                                            type="checkbox"> <span class="option-title"><span style="color:red">[Not
                                                recommended]</span> Set whether Spin Rewriter changes the entire
                                            structure of phrases and sentences.</span></td>
                                </tr>

                                <tr>
                                    <th scope="row">Auto Protected Terms</th>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_AutoProtectedTerms"
                                            type="checkbox"> <span class="option-title"><span style="color:red">[Not
                                                recommended]</span> Set whether Spin Rewriter protect capped letters
                                            from spinning.</span></td>
                                </tr>




                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>


                    <div class="postbox OPT_AUTO_SPIN_OPENAI  spin_method_box ">
                        <h2 class="hndle">
                            <span>OpenAI GPT API (OPTIONAL) <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                             
                            <p>Check this  <a target="_blank" href="https://valvepress.com/how-to-find-your-openai-api-key-for-wordpress-automatic-plugin/">Tutorial</a> on how to get your OpenAI API Key and <a target="_blank" href="https://valvepress.com/how-to-generate-an-openrouter-api-key-for-wordpress-automatic-plugin/">this</a> if you will use OpenRouter. and check this tutorial as well for best configuration <a href="https://valvepress.com/the-best-configuration-for-wordpress-auto-spinner-when-rewriting-using-openai-api/" target="_blank">The best configuration for WordPress Auto Spinner when rewriting using OpenAI API</a></p>



                            <table class="form-table">


                                <!-- apiKey in textarea -->
                                <tr>
                                    <th scope="row">OpenAI API key </td>
                                    <td><textarea style="width:100%" name="wp_auto_spinner_openai_api_key" rows="5"><?php echo $wp_auto_spinner_openai_api_key ; ?></textarea>
                                        <div class="description">You can add a single key or multiple API key (One key per line) for the plugin to rotate between them and use a different key every run </div>
                                </tr>




                                <!-- model text box -->
                                <tr>
                                    <th scope="row">Model (optional) </td>
                                    <td><input style="width:100%" value="<?php echo get_option('wp_auto_spinner_openai_model','') ; ?>"
                                            name="wp_auto_spinner_openai_model" type="text" placeholder="<?php echo WP_AUTO_SPINNER_OPENAI_MODEL ?>">
                                        
                                            <div class="description">The model to use. Defaults to <?php echo WP_AUTO_SPINNER_OPENAI_MODEL ?> for OpenAI and <?php echo WP_AUTO_SPINNER_OPENROUTER_MODEL?> for OpenRouter. You can use  any other model like the  <strong>gpt-4o</strong> or <strong>gpt-4-1106-preview</strong> or any desired model that you want but make sure that not all models are available on free trial. models like gpt-4o or gpt-4 are only available for paying customers.<br><br>*Check the full OpenAI <a target="_blank" href="https://platform.openai.com/docs/models">models list</a>.<br><br>*Check the full OpenRouter <a target="_blank" href="https://openrouter.ai/models" >models list</a>.<br><br>*Leave empty for the plugin to use default models</div>
                                        
                                        </td>
                                </tr>

                                <!-- Not English language checkbox -->
                                <tr>
                                            <th scope="row"><label>Not English language?</label></th>
                                            <td>

                                                <input name="wp_auto_spin[]"  
                                                    value="OPT_AUTO_SPIN_OPENAI_NOT_ENGLISH" type="checkbox"> <span class="option-title">The content is not in English language</span>

                                                    <div class="description">By default the plugin assumes the content is in English language, if it is not, activate this option. This helps the plugin knows the appropriate length that it uses for splitting the content for sending it in multiple requests. non-English API call takes longer than English content rewriting time </div>

                                            </td>

                                 </tr>

                                 <!-- Do no split the content to chunks checkbox -->
                                    <tr>
                                                <th scope="row"><label>Do not split the content to chunks?</label></th>
                                                <td>
    
                                                    <input name="wp_auto_spin[]"  
                                                        value="OPT_AUTO_SPIN_OPENAI_NO_SPLIT" type="checkbox"> <span class="option-title">Do not split the content to chunks</span>
    
                                                        <div class="description">By default the plugin splits the content to chunks, if you want to send the content as a whole without splitting it, activate this option. The plugin originally split the content to chunks and process every chunk with your main prompt seprately to make sure that it gets the response fast and not excced the server timout set for HTTP requests. this option is suitable if you want to generate a new article based on the original content and not just rewrite</div>
    
                                                </td>
                                    </tr>            

                                 <!-- Not English language checkbox -->

                                 <!-- system message for the post title -->
                                <tr>
                                    <th scope="row">System message for the post title (optional) </td>
                                    <td>
                                        <textarea style="width:100%" name="wp_auto_spinner_openai_system_message_title" rows="5"><?php echo  stripslashes( get_option('wp_auto_spinner_openai_system_message_title', WP_AUTO_SPINNER_OPENAI_TITLE_PROMPT ) ) ; ?></textarea>
                                        
                                            <div class="description">The system message is a message that will be sent to the API to help it understand what it should do.<br><br>Default: <code><?php echo WP_AUTO_SPINNER_OPENAI_TITLE_PROMPT ?></code><br><br>Example:<code>Write a new title based on the info from the provided post title</code></div>    
                                    </td>
                                 </tr>
                                
                                 <!-- system message -->
                                <tr>
                                    <th scope="row">System message (optional) </td>
                                    <td>
                                        <textarea style="width:100%" name="wp_auto_spinner_openai_system_message" rows="5"><?php echo  stripslashes( get_option('wp_auto_spinner_openai_system_message','Replace words with other synonyms and change sentences structure but keep HTML tags and format as-is. Do not change the content language') ) ; ?></textarea>
                                        
                                            <div class="description">The system message is a message that will be sent to the API to help it understand what it should do.<br><br>Default: <code>Replace words with other synonyms and change sentences structure but keep HTML tags and format as-is</code><br><br>Example:<code>Write a new article based on the info from the provided post content, add FAQ section and conclusion section </code><br><br>Example: <code>You are a paraphrasing software that takes an article in HTML format and rewrite it in a way that is easy to read and understand, Keep HTML as-is, change the text as far as you can</code><br><br>Example: <code>Replace words with other synonyms in this French language Article  and change sentences structure but keep HTML tags and format as-is. do not change the content language</code><br><br></div>    
                                    </td>
                                 </tr>


                                <!-- temperature -->
                                <tr>
                                    <th scope="row">Temperature (optional) </td>
                                    <td><input style="width:100%" value="<?php echo get_option('wp_auto_spinner_openai_temperature','0.9') ; ?>"
                                            name="wp_auto_spinner_openai_temperature" type="text">

                                            <div class="description">What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. Defaults to 1</div>
                                        
                                        </td>
                                 </tr>

                                 <!-- Top_p -->
                                <tr>
                                    <th scope="row">Top_p </td>
                                    <td><input style="width:100%" value="<?php echo get_option('wp_auto_spinner_openai_top_p','1') ; ?>"
                                            name="wp_auto_spinner_openai_top_p" type="text">
                                        
                                            <div class="description">An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

We generally recommend altering this or temperature but not both. Defaults to 1.</div>
                                        
                                        </td>
                                </tr>

                                <!-- frequency_penalty -->
                                <tr>
                                    <th scope="row">Frequency penalty </td>
                                    <td><input style="width:100%" value="<?php echo get_option('wp_auto_spinner_openai_frequency_penalty','0') ; ?>"
                                            name="wp_auto_spinner_openai_frequency_penalty" type="text">
                                        
                                            <div class="description">Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.</div>
                                        
                                        </td>
                                </tr>

                                <!-- presence_penalty -->
                                <tr>
                                    <th scope="row">Presence penalty </td>
                                    <td><input style="width:100%" value="<?php echo get_option('wp_auto_spinner_openai_presence_penalty','0') ; ?>"
                                            name="wp_auto_spinner_openai_presence_penalty" type="text">
                                        
                                            <div class="description">Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. Defaults to 0</div>
                                        
                                        </td>
                                </tr>

                                 

                                 <!-- category to prompt textarea -->
                                    <tr>
                                        <th scope="row">Category to prompt (optional) ( format categoryID|prompt) (one rule per line) </td>
                                        <td>
                                            <textarea style="width:100%" name="wp_auto_spinner_openai_category_to_prompt" rows="5"><?php echo  stripslashes( get_option('wp_auto_spinner_openai_category_to_prompt','') ) ; ?></textarea>
                                            
                                                <div class="description">This is a list of categories and prompts that will be sent to the API to help it understand what it should do.<br><br>Example:<code>123|Write a new article based on the info from the provided post content, add FAQ section and conclusion section </code><br><br>Example: <code>456|You are a paraphrasing software that takes an article in HTML format and rewrite it in a way that is easy to read and understand, Keep HTML as-is, change the text as far as you can</code><br><br>Example: <code>789|Replace words with other synonyms in this French language Article  and change sentences structure but keep HTML tags and format as-is. do not change the content language</code><br><br>
                                                Tip: Check this tutorial on how to get the category ID <a href="https://valvepress.com/how-to-get-the-wordpress-category-id/" target="_blank">How to get WordPress category ID</a>
                                            </div>
                                        </td>
                                    </tr>
 

                                 
                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>


                    <div class="postbox OPT_AUTO_SPIN_WORDAI  spin_method_box ">
                        <h2 class="hndle">
                            <span>WordAI API (OPTIONAL) <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>Sign up for <a href="http://wordai.com/?ref=4ha50">WordAI</a> API to spin the posts.
                                WordAi fully understands what each word content means and replace properly.</p>



                            <table class="form-table">


                                <tr>
                                    <th scope="row">WordAI email </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_wordai_email; ?>"
                                            name="wp_auto_spinner_wordai_email" type="text"></td>
                                </tr>

                                <tr>
                                    <th scope="row">WordAI API Key</td>
                                    <td><input style="width:100%"
                                            value="<?php echo $wp_auto_spinner_wordai_password; ?>"
                                            name="wp_auto_spinner_wordai_password" type="password"></td>
                                </tr>


                                <tr>
                                    <th scope="row">WordAI uniqueness </td>
                                    <td>


                                        <select name="wp_auto_spinner_wordai_uniqueness">
                                            <option value="1"
                                                <?php opt_selected('1', $wp_auto_spinner_wordai_uniqueness)?>>More
                                                Conservative</option>
                                            <option value="2"
                                                <?php opt_selected('2', $wp_auto_spinner_wordai_uniqueness)?>>Regular
                                            </option>
                                            <option value="3"
                                                <?php opt_selected('3', $wp_auto_spinner_wordai_uniqueness)?>>More
                                                Adventurous</option>

                                        </select>

                                    </td>
                                </tr>

                                <tr>
                                    <th scope="row">WordAI Method </td>
                                    <td>


                                        <select name="wp_auto_spinner_wordai_method">
                                            <option value="rewrite"
                                                <?php opt_selected('rewrite', $wp_auto_spinner_wordai_method)?>>Rewrite</option>
                                            <option value="avoid"
                                                <?php opt_selected('avoid', $wp_auto_spinner_wordai_method)?>>Avoid AI Detection
                                            </option>
                                             

                                        </select>
                                        <div class="description">
                                            <strong>Rewrite:</strong> The plugin will send the content to WordAI and
                                            get it rewritten.<br>
                                            <strong>Avoid AI Detection:</strong> The plugin will send the content to WordAI and use the Avoid AI Detection mode to rewrite it so it passes AI detectors.<br><br><strong>Warning:</strong> Avoid AI Detection from WordAI removes HTML so your resulted content will be plain text without any HTML tags. Use this option only if you need to pass AI detectors and you don't care about HTML tags. 

                                        </div>

                                    </td>
                                </tr>

                                <tr>
                                    <th scope="row">Avoid AI Mode </td>
                                    <td>


                                        <select name="wp_auto_spinner_wordai_mode">
                                            <option value="change_more"
                                                <?php opt_selected('change_more', $wp_auto_spinner_wordai_method)?>>Change More</option>
                                            <option value="change_less"
                                                <?php opt_selected('change_less', $wp_auto_spinner_wordai_method)?>>Change Less
                                            </option>
                                        </select>

                                        <div class="description">
                                         "Change less"  will keep your content largely the same while helping it pass most AI detectors. "Change More" if you need WordAi to be more aggressive to pass AI detectors.

                                        </div>

                                    </td>
                                </tr>

                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>


                    <div class="postbox OPT_AUTO_SPIN_TBS  spin_method_box">
                        <h2 class="hndle">
                            <span>The Best Spinner (OPTIONAL) <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>Sign up for <a href="https://paykstrt.com/10313/57123">TheBestSPinner</a> API to spin the
                                posts using it.</p>



                            <table class="form-table">


                                <tr>
                                    <th scope="row">TheBestSpinner email </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_tbs_email; ?>"
                                            name="wp_auto_spinner_tbs_email" type="text"></td>
                                </tr>

                                <tr>
                                    <th scope="row">TheBestSpinner password </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_tbs_password; ?>"
                                            name="wp_auto_spinner_tbs_password" type="password"></td>
                                </tr>


                                <tr>
                                    <th scope="row">TheBestSpinner maxsyns </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_tbs_maxsyns; ?>"
                                            name="wp_auto_spinner_tbs_maxsyns" type="text">
                                        <div class="description">(the maximum number of synonyms to return for a
                                            word/phrase).</div>
                                    </td>
                                </tr>

                                <tr>
                                    <th scope="row">Quality</td>
                                    <td>


                                        <select name="wp_auto_spinner_tbs_quality">
                                            <option value="1" <?php opt_selected('1', $wp_auto_spinner_tbs_quality)?>>
                                                Good</option>
                                            <option value="2" <?php opt_selected('2', $wp_auto_spinner_tbs_quality)?>>
                                                Better</option>
                                            <option value="3" <?php opt_selected('3', $wp_auto_spinner_tbs_quality)?>>
                                                Best</option>
                                        </select>


                                    </td>
                                </tr>






                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>


                    <div class="postbox OPT_AUTO_SPIN_BOT  spin_method_box">
                        <h2 class="hndle">
                            <span>SpinBot.com (OPTIONAL) <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>Sign up for <a href="http://spinbot.com/">spinbot.com</a> API to spin your posts.</p>

                            <table class="form-table">

                                <tr>
                                    <th scope="row">API key </td>
                                    <td><input style="width:100%"
                                            value="<?php echo get_option('wp_auto_spinner_bot_key', ''); ?>"
                                            name="wp_auto_spinner_bot_key" type="text"></td>
                                </tr>




                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>


                    <div class="postbox OPT_AUTO_SPIN_RP  spin_method_box">
                        <h2 class="hndle">
                            <span>Rewriter/Paraphraser/Text Changer (OPTIONAL) <span
                                    class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>Sign up for <a
                                    href="https://rapidapi.com/smodin/api/rewriter-paraphraser-text-changer-multi-language">Rewriter/Paraphraser/Text</a>
                                API to spin your posts using https://smodin.io/ API.</p>

                            <table class="form-table">

                                <tr>
                                    <th scope="row">API key </td>
                                    <td><input style="width:100%"
                                            value="<?php echo get_option('wp_auto_spinner_rp_key', ''); ?>"
                                            name="wp_auto_spinner_rp_key" type="text"><br>
                                        <div class="description">Check <a
                                                href="https://valvepress.com/how-to-get-smodin-io-rewriter-paraphraser-text-api-key/">this
                                                tutorial</a> on how to get the API key</div>

                                    </td>
                                </tr>

                                <tr>
                                    <th scope="row">Language </td>
                                    <td><input style="width:100%"
                                            value="<?php echo get_option('wp_auto_spinner_rp_lang', 'en'); ?>"
                                            name="wp_auto_spinner_rp_lang" type="text">
                                        <div class="description">*Two letters language code<br>*example: add en for
                                            English<br>*example: add fr for French<br>*example: add ar for Arabic</div>

                                    </td>
                                </tr>


                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>

                    <div class="postbox OPT_AUTO_SPIN_ES  spin_method_box">
                        <h2 class="hndle">
                            <span>Espinner.net (OPTIONAL) <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>Sign up for <a href="http://espinner.net/">Espinner.net</a> API to spin your posts in
                                Spanish.</p>



                            <table class="form-table">


                                <tr>
                                    <th scope="row">Espinner email </td>
                                    <td><input style="width:100%"
                                            value="<?php echo get_option('wp_auto_spinner_es_email', ''); ?>"
                                            name="wp_auto_spinner_es_email" type="text"></td>
                                </tr>

                                <tr>
                                    <th scope="row">Espinner API key </td>
                                    <td><input style="width:100%"
                                            value="<?php echo get_option('wp_auto_spinner_es_password', ''); ?>"
                                            name="wp_auto_spinner_es_password"></td>
                                </tr>


                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>

                    <!-- Undetectable API -->
                    <div class="postbox OPT_AUTO_SPIN_UAI  spin_method_box">
                        <h2 class="hndle">
                            <span>Undetectable.ai Humanizer (OPTIONAL) <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>Sign up for <a href="https://undetectable.ai?_by=i2ipc">Undetectable.ai</a> API to humanize
                                your posts.</p>

                            <table class="form-table">

                                <tr>
                                    <th scope="row">API key </td>
                                    <td><input style="width:100%"
                                            value="<?php echo get_option('wp_auto_spinner_uai_key', ''); ?>"
                                            name="wp_auto_spinner_uai_key" type="text"></td>
                                </tr>

                            </table>

                        </div>
                    </div>


                    <div class="postbox OPT_AUTO_SPIN_CP spin_method_box">
                        <h2 class="hndle">
                            <span>ContentProfessor API (OPTIONAL) <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>By default, the plugin uses its internal synonyms database, but you still can use <a
                                    href="http://www.contentprofessor.com/go.php?offer=sweetheatm">ContentProfessor</a>
                                API to spin the posts.</p>



                            <table class="form-table">



                                <tr>
                                    <th scope="row">ContentProfessor username </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_cp_email; ?>"
                                            name="wp_auto_spinner_cp_email" type="text"></td>
                                </tr>

                                <tr>
                                    <th scope="row">ContentProfessor password </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_cp_password; ?>"
                                            name="wp_auto_spinner_cp_password" type="password"></td>
                                </tr>

                                <tr>
                                    <th scope="row">Member Type</td>
                                    <td>


                                        <select name="wp_auto_spinner_cp_type">
                                            <option value="free" <?php opt_selected('free', $wp_auto_spinner_cp_type)?>>
                                                Free User</option>
                                            <option value="pro" <?php opt_selected('pro', $wp_auto_spinner_cp_type)?>>
                                                Pro user (paid)</option>

                                        </select>


                                    </td>
                                </tr>



                                <tr>
                                    <th scope="row">language</td>
                                    <td>


                                        <select name="wp_auto_spinner_cp_language">
                                            <option value="en" <?php opt_selected('en', $wp_auto_spinner_cp_language)?>>
                                                English</option>
                                            <option value="es" <?php opt_selected('es', $wp_auto_spinner_cp_language)?>>
                                                Spanish</option>
                                            <option value="fr" <?php opt_selected('fr', $wp_auto_spinner_cp_language)?>>
                                                French</option>
                                            <option value="de" <?php opt_selected('de', $wp_auto_spinner_cp_language)?>>
                                                German</option>
                                            <option value="it" <?php opt_selected('it', $wp_auto_spinner_cp_language)?>>
                                                Italian</option>
                                        </select>


                                    </td>
                                </tr>


                                <tr>
                                    <th scope="row">ContentProfessor maxsyns </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_cp_limit; ?>"
                                            name="wp_auto_spinner_cp_limit" type="text">
                                        <div class="description">(the maximum number of synonyms to return for a
                                            word/phrase).</div>
                                    </td>
                                </tr>


                                <tr>
                                    <th scope="row">Quality</td>
                                    <td>


                                        <select name="wp_auto_spinner_cp_quality">
                                            <option value="ok" <?php opt_selected('ok', $wp_auto_spinner_cp_quality)?>>
                                                OK</option>
                                            <option value="better"
                                                <?php opt_selected('better', $wp_auto_spinner_cp_quality)?>>Better
                                            </option>
                                            <option value="ideal"
                                                <?php opt_selected('ideal', $wp_auto_spinner_cp_quality)?>>Ideal
                                            </option>

                                        </select>


                                    </td>
                                </tr>


                                <tr>
                                    <th scope="row">Synonyms set</td>
                                    <td>


                                        <select name="wp_auto_spinner_cp_synonym_set">
                                            <option value="global"
                                                <?php opt_selected('global', $wp_auto_spinner_cp_synonym_set)?>>Global
                                            </option>
                                            <option value="my"
                                                <?php opt_selected('my', $wp_auto_spinner_cp_synonym_set)?>>My sets
                                            </option>
                                        </select>


                                        <div class="description">Select "My" only if you want to use your saved synonyms
                                            sets at contentProcessor site</div>


                                    </td>
                                </tr>



                                <tr>
                                    <th scope="row">ContentProfessor minimum word count </td>
                                    <td><input style="width:100%"
                                            value="<?php echo $wp_auto_spinner_cp_min_words_count; ?>"
                                            name="wp_auto_spinner_cp_min_words_count" type="text">
                                        <div class="description">(Minimum word count in a synonym phrase. Default:1).
                                        </div>
                                    </td>
                                </tr>

                                <tr>
                                    <th scope="row">ContentProfessor maximum word count </td>
                                    <td><input style="width:100%"
                                            value="<?php echo $wp_auto_spinner_cp_max_words_count; ?>"
                                            name="wp_auto_spinner_cp_max_words_count" type="text">
                                        <div class="description">(Maximum word count in a synonym phrase. Default:7).
                                        </div>
                                    </td>
                                </tr>


                                <tr>
                                    <th scope="row">Disable Removal </td>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CP_REMOVAL" type="checkbox">
                                        <span class="option-title"> Disable ContentProfessor Removal . </span>
                                        <div class="description">Disable use current member account removal in method
                                            operations.</div>
                                    </td>

                                </tr>

                                <tr>
                                    <th scope="row">Disable excludes </td>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CP_EXECLUDE" type="checkbox">
                                        <span class="option-title"> Exclude member excludes from spin operations.</span>
                                        <div class="description">Disable use current member account removal in method
                                            operations.</div>
                                    </td>

                                </tr>

                                <tr>
                                    <th scope="row">Disable execluding stop words </td>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CP_STOP" type="checkbox">
                                        <span class="option-title"> Exclude member excludes from spin operations.</span>
                                        <div class="description">Disable Exclude stop words from spin operations..</div>
                                    </td>

                                </tr>


                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>







                    <div class="postbox OPT_AUTO_SPIN_SC  spin_method_box">
                        <h2 class="hndle">
                            <span>SpinnerChief (OPTIONAL) <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>By Default, the plugin uses its internal synonyms database but you still can use <a
                                    href="http://www.whitehatbox.com/Agents/SSS?code=o484rg1x4/BSxXSuwed4BY9KWRedbqx1GSapvkPuytaDOooV9SfW4A==">SpinnerChief</a>
                                API to spin the posts .</p>
                             


                            <table class="form-table">

                                <!-- api_key -->
                                <tr>
                                    <th scope="row">SpinnerChief api key </td>
                                    <td><input style="width:100%" value="<?php echo get_option('wp_auto_spinner_sc_api_key','') ; ?>"
                                            name="wp_auto_spinner_sc_api_key" type="text"></td>
                                </tr>

                                <!-- dev_key -->
                                <tr>
                                    <th scope="row">SpinnerChief dev key </td>
                                    <td><input style="width:100%" value="<?php echo get_option('wp_auto_spinner_sc_dev_key','') ; ?>"
                                            name="wp_auto_spinner_sc_dev_key" type="text">
                                    </td>
                                </tr>

                                 

                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>

                    <div class="postbox OPT_AUTO_SPIN_CR spin_method_box">
                        <h2 class="hndle">
                            <span>ChimpRewriter (OPTIONAL) <span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <p>Sign up for <a href="http://chimprewriter.com?a_aid=55006517c7d97">ChimpRewriter</a> API
                                to spin the posts. Chimp Rewriter's technology is built upon exhaustive research on
                                Natural Language Processing.</p>



                            <table class="form-table">



                                <tr>
                                    <th scope="row">ChimpRewriter email </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_cr_email; ?>"
                                            name="wp_auto_spinner_cr_email" type="text"></td>
                                </tr>

                                <tr>
                                    <th scope="row">ChimpRewriter apikey </td>
                                    <td><input style="width:100%" value="<?php echo $wp_auto_spinner_cr_apikey; ?>"
                                            name="wp_auto_spinner_cr_apikey" type="password"></td>
                                </tr>

                                <tr>
                                    <th scope="row">Quality</td>
                                    <td>


                                        <select name="wp_auto_spinner_cr_quality">
                                            <option value="5" <?php opt_selected('5', $wp_auto_spinner_cr_quality)?>>
                                                Best </option>
                                            <option value="4" <?php opt_selected('4', $wp_auto_spinner_cr_quality)?>>
                                                Better </option>
                                            <option value="3" <?php opt_selected('3', $wp_auto_spinner_cr_quality)?>>
                                                Good </option>
                                            <option value="2" <?php opt_selected('2', $wp_auto_spinner_cr_quality)?>>
                                                Average </option>
                                            <option value="1" <?php opt_selected('1', $wp_auto_spinner_cr_quality)?>>All
                                            </option>
                                        </select>


                                    </td>
                                </tr>

                                <tr>
                                    <th scope="row">Phrase quality</td>
                                    <td>


                                        <select name="wp_auto_spinner_cr_phrasequality">
                                            <option value="5"
                                                <?php opt_selected('5', $wp_auto_spinner_cr_phrasequality)?>>Best
                                            </option>
                                            <option value="4"
                                                <?php opt_selected('4', $wp_auto_spinner_cr_phrasequality)?>>Better
                                            </option>
                                            <option value="3"
                                                <?php opt_selected('3', $wp_auto_spinner_cr_phrasequality)?>>Good
                                            </option>
                                            <option value="2"
                                                <?php opt_selected('2', $wp_auto_spinner_cr_phrasequality)?>>Average
                                            </option>
                                            <option value="1"
                                                <?php opt_selected('1', $wp_auto_spinner_cr_phrasequality)?>>All
                                            </option>
                                        </select>

                                        <div class="description">
                                            Phrase replacement quality
                                        </div>


                                    </td>
                                </tr>

                                <tr>
                                    <th scope="row">Pos match</td>
                                    <td>


                                        <select name="wp_auto_spinner_cr_posmatch">

                                            <option value="3" <?php opt_selected('3', $wp_auto_spinner_cr_posmatch)?>>
                                                Full</option>
                                            <option value="2" <?php opt_selected('2', $wp_auto_spinner_cr_posmatch)?>>
                                                Loose </option>
                                            <option value="1" <?php opt_selected('1', $wp_auto_spinner_cr_posmatch)?>>
                                                Extremely Loose </option>
                                            <option value="0" <?php opt_selected('0', $wp_auto_spinner_cr_posmatch)?>>
                                                none </option>

                                        </select>

                                        <div class="description">
                                            Required Part of Speech (POS) match for a spin:
                                        </div>



                                    </td>
                                </tr>



                                <tr>

                                    <td colspan="2">

                                        Spins or rewrites an article. Standard spinning costs 1 credit per 5000 words.
                                        Advanced spinning costs 1 credit per 500 words. A spin is “advanced” if any of
                                        the advanced parameters below are set to 1.

                                    </td>

                                </tr>


                                <tr>
                                    <th scope="row">Use sentencerewrite (Advanced) </td>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CR_SREWRITE" type="checkbox">
                                        <span class="option-title">Check to use artificial intelligence tools to
                                            automatically rewrite sentences . </span>
                                    </td>
                                </tr>

                                <tr>
                                    <th scope="row">Use Grammer Check (Advanced) </td>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CR_GCHECK" type="checkbox">
                                        <span class="option-title"> Use grammar correction . </span>
                                    </td>
                                </tr>

                                <tr>
                                    <th scope="row">Reorder Paragraphs </td>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CR_reorderparagraphs"
                                            type="checkbox"> <span class="option-title"> Randomly reorder paragraphs .
                                        </span></td>
                                </tr>

                                <tr>
                                    <th scope="row">Replace phrases with phrases </td>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CR_replacephraseswithphrases"
                                            type="checkbox"> <span class="option-title"> Always replace phrases with
                                            equivalent phrases, regardless of quality. Results in a huge amount of spin
                                            but may not yield the best quality.</span></td>
                                </tr>

                                <tr>
                                    <th scope="row">Disable spintidy</td>
                                    <td><input name="wp_auto_spin[]" value="OPT_AUTO_SPIN_CR_spintidy" type="checkbox">
                                        <span class="option-title">Runs a spin tidy pass over the result article. This
                                            fixes any common a/an type grammar mistakes and repeated words due to phrase
                                            spinning. Generally increases the quality of the article.</span>
                                    </td>
                                </tr>


                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" value="Save Settings" name="submit" class="button">
                            </p>



                            <!-- /insider 3 -->
                        </div>
                    </div>

                    <?php }?>


                    <div class="postbox">
                        <h2 class="hndle">
                            <span>License<span class="postbox-title-action"></span></span>
                        </h2>
                        <div class="inside">
                            <!-- insider 3 -->

                            <table class="form-table">
                                <tbody>


                                    <?php 

//id hostname contains valvepress.com do not show license field
if (isset($_SERVER['HTTP_HOST']) && stristr($_SERVER['HTTP_HOST'], 'valvepress.com')) {
    //do nothing
} else {

?>
                                    <tr>
                                        <th scope="row"><label>Purchase Code</label></th>
                                        <td><input class="widefat" name="wp_auto_spinner_license"
                                                value="<?php echo get_option('wp_auto_spinner_license', '') ?>"
                                                type="text">

                                            <div class="description">If you don't know what is your purchase code check
                                                this <a href="http://www.youtube.com/watch?v=eAHsVR_kO7A">video</a> on
                                                how to get it. or find the offical plugin sales page <a href="http://1.envato.market/MdXG2">HERE!</a> </div>
                                        </td>
                                    </tr>

<?php }?>

                                    <?php if (isset($license_error) && stristr($license_error, 'another')) {?>

                                    <tr>
                                        <th scope="row"><label> Change domain </label></th>
                                        <td><input name="wp_auto_spin[]" value="OPT_CHANGE_DOMAIN" type="checkbox">
                                            <span class="option-title"> Disable license at the other domain and use it
                                                with this domain </span>
                                        </td>
                                    </tr>

                                    <?php }?>

                                    <tr>
                                        <th scope="row"><label>License Status</label></th>
                                        <td>

                                            <div class="description"><?php

    if (trim($license_active) != '') {
        echo 'Active';
    } else {
        echo 'Inactive ';
        if (isset($license_error)) {
            echo '<p><span style="color:red">' . $license_error . '</span></p>';
        }

    }

    ?></div>
                                        </td>
                                    </tr>


                                </tbody>
                            </table>

                            <p style="padding-top: 5px">
                                <input type="submit" class="button" name="submit" value="Save Settings">
                            </p>


                            <!-- /insider 3 -->
                        </div>
                    </div>



                </div>
            </div>


        </div>


        <div class="clear"></div>

    </form>
    <!--/TTWForm-->
</div>

<script type="text/javascript">
<?php $opt = get_option('wp_auto_spin', array());

    if (in_array('OPT_AUTO_SPIN_REWRITER', $opt)) {

    } elseif (in_array('OPT_AUTO_SPIN_WORDAI', $opt)) {

    } elseif (in_array('OPT_AUTO_SPIN_TBS', $opt)) {

    } elseif (in_array('OPT_AUTO_SPIN_CP', $opt)) {

    } elseif (in_array('OPT_AUTO_SPIN_SC', $opt)) {

    } elseif (in_array('OPT_AUTO_SPIN_CR', $opt)) {

    } elseif (in_array('OPT_AUTO_SPIN_ES', $opt)) {

    }elseif (in_array('OPT_AUTO_SPIN_UAI', $opt)) {    

    } elseif (in_array('OPT_AUTO_SPIN_BOT', $opt)) {

    } elseif (in_array('OPT_AUTO_SPIN_QU', $opt)) {

    } elseif (in_array('OPT_AUTO_SPIN_RP', $opt)) {

	} elseif (in_array('OPT_AUTO_SPIN_OPENAI', $opt)) {


    } else {

        $opt[] = 'OPT_AUTO_INTERNAL';

    }

    ?>

var $vals = '<?php $wp_spinner_types = get_option('wp_spinner_types', array('post', 'product'));
    print_r(implode('|', array_merge($opt, $wp_spinner_types)));?>';



//generic options
$val_arr = $vals.split('|');
jQuery('input:checkbox').removeAttr('checked');
jQuery.each($val_arr, function(index, value) {
    if (value != '') {
        jQuery('input:checkbox[value="' + value + '"]').prop('checked', true);
        jQuery('input:radio[value="' + value + '"]').prop('checked', true);
    }
});

//spin execludes options
var $vals = '<?php $opt = get_option('wp_auto_spin_execl', array());
    print_r(implode('|', $opt));?>';
$val_arr = $vals.split('|');

jQuery.each($val_arr, function(index, value) {
    if (value != '') {
        jQuery('input:checkbox[value="' + value + '"]').prop('checked', true);

    }
});


//show hide spinning boxs for other methods

jQuery('.spinning_method_wrap input[type="radio"]').change(

    function() {
        showHideSpinBox();
    }

);

function showHideSpinBox() {

    jQuery('.spin_method_selector:checked').each(function() {

        jQuery('.spin_method_box').hide();

        jQuery('.' + jQuery(this).val()).show();

        console.log(jQuery(this).val());

    });

}

//initial trigger
showHideSpinBox();
</script>

<?php }?>