<?php 

defined('ABSPATH') or die("You can't access this file directly.");


if ( ! function_exists( 'qcld_seohelp_summarizer_page_callback_func' ) ) {
    function qcld_seohelp_summarizer_page_callback_func() {

    	$qcld_seohelp_summarizer_enable 		= get_option('qcld_seohelp_summarizer_enable');
    	$qcld_seohelp_summarizer_post 			= get_option('qcld_seohelp_summarizer_post');
    	$qcld_seohelp_display_summary 			= get_option('qcld_seohelp_display_summary');
    	$qcld_seohelp_sentence_length 			= get_option('qcld_seohelp_sentence_length');
    	$qcld_seohelp_summary_title 			= get_option('qcld_seohelp_summary_title');
    	$qcld_seohelp_summary_post_type_data 	= get_option('qcld_seohelp_summary_post_type_data');

    	?>
		<div class="wrap fs-section">
            <?php $seo_help_url = esc_url(admin_url('admin.php?page=qcld-seo-other-features')); ?>
            <div style="margin: 15px 0 25px 0;">
                <a href="<?php echo esc_url($seo_help_url); ?>" class="button button-secondary">
                    <span class="dashicons dashicons-arrow-left-alt"></span>
                    <?php esc_html_e('Back to SEO Help Page', 'seo-help'); ?>
                </a>
            </div>

		    <div id="poststuff">
		        <div id="fs_account">
		        	<h3><?php esc_html_e("Automatic Posts Summarizer", 'seo-help'); ?></h3>
                    <div class="qcld_summarizer_notice">
                        <p><?php esc_html_e("Automatic content summarizer can be helpful for both your readers and SEO. It is automatically added to your contents and can make your content look fresh to Search Engines if you enable Generate multiple summaries and use them randomly.", 'seo-help'); ?></p>

                    	<p><?php esc_html_e("This is a Pro version feature.", 'seo-help'); ?> <a href="<?php echo esc_url('https://www.dna88.com/product/seo-help-pro/'); ?>"><?php esc_html_e("Upgrade to SEO Help Pro Now!", 'seo-help'); ?></a></p>
                    </div>

		        	<form action="" method="post" class="summarize">
			            <table class="form-table">
			                <tbody>
			                <tr>
			                    <th scope="row"><?php esc_html_e("Enable Summarizer", 'seo-help'); ?></th>
			                    <td>
			                        <input type="checkbox" class="" name="qcld_seohelp_summarizer_enable" id="qcld_seohelp_summarizer_enable" value="1" <?php echo(get_option('qcld_seohelp_summarizer_enable') == 1 ? 'checked' : ''); ?>>
			                    </td>
			                </tr>
                            <tr>
                                <th scope="row"><?php esc_html_e("Generate multiple summaries and use them randomly", 'seo-help'); ?></th>
                                <td>
                                    <input type="checkbox" class="" name="qcld_seohelp_summary_generate" id="qcld_seohelp_summary_generate" value="1" <?php echo(get_option('qcld_seohelp_summary_generate') == 1 ? 'checked' : ''); ?>>
                                </td>
                            </tr>
			                <tr>
			                    <th scope="row"><?php esc_html_e("Display Summary on All Posts", 'seo-help'); ?></th>
			                    <td>
			                        <input type="checkbox" class="" name="qcld_seohelp_summarizer_post" id="qcld_seohelp_summarizer_post" value="1" <?php echo(get_option('qcld_seohelp_summarizer_post') == 1 ? 'checked' : ''); ?>>
			                    </td>
			                </tr>
			                <tr>
			                    <th scope="row"><?php esc_html_e("Display Summary", 'seo-help'); ?></th>
			                    <td>
			                        <select name="qcld_seohelp_display_summary" id="qcld_seohelp_display_summary">
			                        	<option value="before" 	<?php selected( get_option('qcld_seohelp_display_summary'), 'before' ); ?> ><?php esc_html_e("Before Post Content", 'seo-help'); ?></option>
			                        	<option value="after" 	<?php selected( get_option('qcld_seohelp_display_summary'), 'after' ); ?> ><?php esc_html_e("After Post Content", 'seo-help'); ?></option>
			                        </select>
			                    </td>
			                </tr>
			                <tr>
			                    <th scope="row"><?php esc_html_e("Summary Sentences Length", 'seo-help'); ?></th>
			                    <td>
			                        <input type="number" class="qcld_seohelp_sentence_length_custom" name="qcld_seohelp_sentence_length" id="qcld_seohelp_sentence_length" 
			                        value="<?php echo esc_attr(get_option('qcld_seohelp_sentence_length')); ?>">
			                    </td>
			                </tr>
			                <tr>
			                    <th scope="row"><?php esc_html_e("Summary Title", 'seo-help'); ?></th>
			                    <td>
			                        <input type="text" class="regular-text qcld_seohelp_sentence_length_custom" name="qcld_seohelp_summary_title" id="qcld_seohelp_summary_title" value="<?php echo esc_attr(get_option('qcld_seohelp_summary_title')); ?>">
			                    </td>
			                </tr>
			                <tr>
			                    <th scope="row"><?php esc_html_e("Display Summary Style", 'seo-help'); ?></th>
			                    <td>
			                        <select name="qcld_seohelp_display_summary_style" id="qcld_seohelp_display_summary_style">
			                        	<option value="one" <?php selected( get_option('qcld_seohelp_display_summary_style'), 'one' ); ?> ><?php esc_html_e("Style One", 'seo-help'); ?></option>
			                        	<option value="two" <?php selected( get_option('qcld_seohelp_display_summary_style'), 'two' ); ?> ><?php esc_html_e("Style Two", 'seo-help'); ?></option>
			                        	<option value="three" <?php selected( get_option('qcld_seohelp_display_summary_style'), 'three' ); ?> ><?php esc_html_e("Style Three", 'seo-help'); ?></option>
			                        	<option value="four" <?php selected( get_option('qcld_seohelp_display_summary_style'), 'four' ); ?> ><?php esc_html_e("Style Four", 'seo-help'); ?></option>
			                        	<option value="five" <?php selected( get_option('qcld_seohelp_display_summary_style'), 'five' ); ?> ><?php esc_html_e("Style Five", 'seo-help'); ?></option>
			                        	<option value="six" <?php selected( get_option('qcld_seohelp_display_summary_style'), 'six' ); ?> ><?php esc_html_e("Style Six", 'seo-help'); ?></option>
			                        	<option value="seven" <?php selected( get_option('qcld_seohelp_display_summary_style'), 'seven' ); ?> ><?php esc_html_e("Style Seven", 'seo-help'); ?></option>
			                        	<option value="eight" <?php selected( get_option('qcld_seohelp_display_summary_style'), 'eight' ); ?> ><?php esc_html_e("Style Eight", 'seo-help'); ?></option>
			                        	<option value="nine" <?php selected( get_option('qcld_seohelp_display_summary_style'), 'nine' ); ?> ><?php esc_html_e("Style Nine", 'seo-help'); ?></option>
			                        	<option value="ten" <?php selected( get_option('qcld_seohelp_display_summary_style'), 'ten' ); ?> ><?php esc_html_e("Style Ten", 'seo-help'); ?></option>
			                        </select>
			                    </td>
			                </tr>
			                <tr>
			                    <th scope="row"><?php esc_html_e("Summary Background Color", 'seo-help'); ?></th>
			                    <td>
			                        <input type="text" class="qcld-seo-color qcld_seohelp_sentence_length_custom" name="qcld_seohelp_summary_bg" id="qcld_seohelp_summary_bg" value="<?php echo esc_attr(get_option('qcld_seohelp_summary_bg')); ?>">
			                    </td>
			                </tr>
			                <tr>
			                    <th scope="row"><?php esc_html_e("Summary Border Color", 'seo-help'); ?></th>
			                    <td>
			                        <input type="text" class="qcld-seo-color qcld_seohelp_sentence_length_custom" name="qcld_seohelp_summary_border_color" id="qcld_seohelp_summary_border_color" value="<?php echo esc_attr(get_option('qcld_seohelp_summary_border_color')); ?>">
			                    </td>
			                </tr>
			                <tr>
			                    <th scope="row"><?php esc_html_e("Summary Font Color", 'seo-help'); ?></th>
			                    <td>
			                        <input type="text" class="qcld-seo-color qcld_seohelp_sentence_length_custom" name="qcld_seohelp_summary_font_color" id="qcld_seohelp_summary_font_color" value="<?php echo esc_attr(get_option('qcld_seohelp_summary_font_color')); ?>">
			                    </td>
			                </tr>
                           	<tr>
                               <th><?php esc_html_e( 'Post types', 'seo-help' ); ?></th>
                               <td class="qcld-list">
                                   <input type="checkbox" name="qcld_seohelp_summary_post_type_data[]" id="qcld_seohelp_summary_post_type_post" value="post" <?php 

                                            if( isset($qcld_seohelp_summary_post_type_data) && !empty($qcld_seohelp_summary_post_type_data) ){

                                                foreach(unserialize($qcld_seohelp_summary_post_type_data) as $post){
                                                    if('post' == $post){
                                                        echo esc_attr('checked');
                                                    }
                                                }  
                                            }else if('post' == 'post'){
                                                echo esc_attr('checked');
                                            }

                                         ?> >
                                   <label for="qcld_seohelp_summary_post_type_post"><?php echo esc_attr('Post', 'seo-help') ?> (<code><?php echo esc_attr( 'post', 'seo-help') ?></code>)</label><br>


                                   <input type="checkbox" name="qcld_seohelp_summary_post_type_data[]" id="qcld_seohelp_summary_post_type_page" value="page" <?php 

                                            if( isset($qcld_seohelp_summary_post_type_data) && !empty($qcld_seohelp_summary_post_type_data) ){

                                                foreach(unserialize($qcld_seohelp_summary_post_type_data) as $post){
                                                    if('page' == $post){
                                                        echo esc_attr('checked');
                                                    }
                                                }  
                                            }

                                         ?> >
                                   <label for="qcld_seohelp_summary_post_type_page"><?php echo esc_attr('Page', 'seo-help') ?> (<code><?php echo esc_attr( 'post', 'seo-help') ?></code>)</label><br>

                                   <input type="checkbox" name="qcld_seohelp_summary_post_type_data[]" id="qcld_seohelp_summary_post_type_product" value="product" <?php 

                                            if( isset($qcld_seohelp_summary_post_type_data) && !empty($qcld_seohelp_summary_post_type_data) ){

                                                foreach(unserialize($qcld_seohelp_summary_post_type_data) as $post){
                                                    if('product' == $post){
                                                        echo esc_attr('checked');
                                                    }
                                                }  
                                            }

                                         ?> >
                                   <label for="qcld_seohelp_summary_post_type_product"><?php echo esc_attr('Product', 'seo-help') ?> (<code><?php echo esc_attr( 'product', 'seo-help') ?></code>)</label><br>
                               </td>
                           	</tr>
                            <tr>
                                <th scope="row"><?php esc_html_e("Show Summary by Shortcode", 'seo-help'); ?></th>
                                <td>
                                    <code>[qc_summary] </code> <i style="padding-left: 15px"> <?php esc_html_e(" If you want to show summary individual page or post only.", 'seo-help'); ?></i>
                                </td>
                            </tr>
			                <tr>
			                    <th scope="row">
			                    	<?php esc_html_e("This is a Pro version feature.", 'seo-help'); ?> 
			                    </th>
			                    <td>
			                        
			                    	<p><a href="<?php echo esc_url('https://www.dna88.com/product/seo-help-pro/'); ?>"><?php esc_html_e("Upgrade to SEO Help Pro Now!", 'seo-help'); ?></a></p>
			                    </td>
			                </tr>
			                <tr>
			                    <th scope="row">
			                    	<button type="submit" class="button button-primary" disabled><?php esc_html_e('Save Settings', 'seo-help'); ?></button>
			                    </th>
			                    <td>
			                        
			                    	<?php wp_nonce_field('seo-help'); ?>
			                    </td>
			                </tr>
			               
			                </tbody>
			            </table>
			        </form>
		        </div>
		    </div>
		</div>


    	<?php 

    } // end
} // end

