<?php

if (! defined('ABSPATH') ) { exit;
}
require_once 'legalPages.php';
global $wpdb;
$lpObj = new legalPages();
$lpObj->lp_enqueue_editor();
$baseurl = $_SERVER['PHP_SELF'];


if(isset($_POST['lp_submit']) && $_POST['lp_submit']=='Accept') {
    update_option('lp_accept_terms', $_POST['lp_accept_terms']);
}

?>
    <script type="text/javascript">
        jQuery(document).ready(function () {
            jQuery('#ffbox').click(function () {
                jQuery('#fancyboxOptions').fadeToggle('slow', function () {
                    // Animation complete.
                });
            });
            jQuery('#gsbox').click(function () {
                jQuery('#wpgattack_generalid').fadeToggle('slow', function () {
                    // Animation complete.
                });
            });
        });
    </script>
    <div style="width:1000px;float:left;">
       
        <h1 class="logo-hh"><img style="width: 142px;" src="<?php echo plugin_dir_url(__FILE__); ?>image/wpLegalEagle2.png"></h1>
        <p>WP Legal Eagle is an easy to use legal statement plugin. You can quickly add in legal pages to your wordpress post/pages, manage & edit ANY template, create pages all driven off custom short codes.</p>
        <p>A big time saver is our unique (auto-fill) business data feature... The information you fill in the general settings will be automatically filled into the appropriate places within the pages effortlessly.</p>
        <p>Users also have the ability to create unlimited popups that will force the visitor to agree to your terms before the page unlock allowing them to proceed.</p>
        <p>  </div>
    <div style="clear:both;"></div>
    <?php
$lpterms = get_option('lp_accept_terms');
if($lpterms==1) {?>
        <div class="wrap">
            <?php
if(!empty($_POST) && isset($_POST['lp-greset']) && $_POST['lp-greset']=='Reset') :
    $lp_general = array(
                'domain' => '',
                'business' => '',
                'phone' => '',
                'street' => '',
                'cityState' => '',
                'country' => '',
                'email' => '',
                'address' => '',
                'niche' => '',
                'facebook-url'=>'',
                'google-url'=>'',
                'twitter-url'=>'',
                'linkedin-url'=>'',
                'pagefooter' => '',
                'search'=>'',
                'is_adult'=>'',
                'generate'=>'',
                 'gdpr_button_val'=>'',
                 'article_content'=>''

                );
    update_option('lp_general', $lp_general);
?>

                <div id="message" class="updated">
                    <p>Settings Reset.</p>
                </div>
                <?php
endif;
if(!empty($_POST) && isset($_POST['lp-gsubmit']) && $_POST['lp-gsubmit']=='Save') :


//print_r( $_POST['article_content']);
//exit;
//print_r($_POST); 
    $lp_general = array(
                'domain' => sanitize_text_field(esc_attr($_POST['lp-domain-name'])),
                'business' =>sanitize_text_field(esc_attr($_POST['lp-business-name'])),
                'phone' => sanitize_text_field(esc_attr($_POST['lp-phone'])),
                'street' => sanitize_text_field(esc_attr($_POST['lp-street'])),
                'cityState' => sanitize_text_field(esc_attr($_POST['lp-city-state'])),
                'country' => sanitize_text_field(esc_attr($_POST['lp-country'])),
                'email' =>  sanitize_email(esc_attr($_POST['lp-email'])),
                'address' => sanitize_text_field(esc_attr($_POST['lp-address'])),
                'niche' => sanitize_text_field(esc_attr($_POST['lp-niche'])),
                'facebook-url' => sanitize_text_field(esc_attr($_POST['lp-facebook-url'])),
                'google-url' => sanitize_text_field(esc_attr($_POST['lp-google-url'])),
                'twitter-url' => sanitize_text_field(esc_attr($_POST['lp-twitter-url'])),
                'linkedin-url' => sanitize_text_field(esc_attr($_POST['lp-linkedin-url'])),
                'leave-url'    => sanitize_text_field(esc_attr($_POST['lp-leave-url'])),
                'article_content' =>  $_POST['article_content'],

    );

    if(isset($_POST['lp-is_adult'])){
     update_option('lp_eu_adult_enable',sanitize_text_field($_POST['lp-is_adult']));    
    } else {
     update_option('lp_eu_adult_enable','off'); 
    }
   
    if(isset($_POST['lp-search'])) {
        $lp_general['search']=sanitize_text_field(esc_attr($_POST['lp-search']));
    } else {
        $lp_general['search']=0;
    }

    if(isset($_POST['lp-generate'])) {
        $lp_general['generate']=sanitize_text_field(esc_attr($_POST['lp-generate']));
    } else {
        $lp_general['generate']=0;
    }

    if(isset($_POST['lp-is_adult'])) {
        $lp_general['is_adult']=sanitize_text_field(esc_attr($_POST['lp-is_adult']));
    } else {
        $lp_general['is_adult']=0;
    }

    update_option('lp_general', $lp_general);

    if(isset($_POST['lp-affiliate-disclosure'])) {
        $lp_general['affiliate-disclosure']=    sanitize_text_field(esc_attr($_POST['lp-affiliate-disclosure']));
    } else {
        $lp_general['affiliate-disclosure']=0;
    }
    update_option('lp_general', $lp_general);

    $lp_general['disable_comments']=1;
    update_option('lp_general', $lp_general);

?>



                    <div id="message">
                        <p><span class="label label-success myAlert">Settings saved</span></p>
                    </div>
                    <?php
endif;

      $checked = 'checked="checked"'; $selected = 'selected="selected"';
      $lp_general = get_option('lp_general');

      


    
?>
                        <style type="text/css">
                            #lp_generalid {
                                padding: 5px 20px 20px 20px;
                            }

                            #lp_generalid td {
                                padding: 5px;
                                height: 20px;
                                font-size: 14px;
                            }

                            #lp_generalid input[type=text] {
                                width: 300px;
                                height: 30px;
                                font-size: 14px;
                                color: #666;
                            }

                            #lp_generalid p {
                                font-size: 16px;
                            }

                            #lp_generalid p a {
                                text-decoration: none;
                            }

                       
                        </style>
                        <?php global $wpgattack; ?>
                            <div class="postbox ">
                                <h3 class="hndle title-head" style="cursor:pointer; padding:7px 10px; font-size:20px;"> <?php _e('General Settings','wplegalpages') ?></h3>
                                <div id="lp_generalid">
                                    <form name="glegal" method="post" action="" enctype="">
                                        
                                        <table cellpadding="0" cellspacing="0" border="0">
                                            <tr>
                                                <td></td>
                                                <td></td>
                                                <td><b class="hndle field_title"><?php _e('Shortcodes','wplegalpages'); ?></b></td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Domain Name:','wplegalpages'); ?></b></td>
                                                <td>
                                                    <input type="text" name="lp-domain-name" value="<?php echo !empty($lp_general['domain'])?$lp_general['domain']:get_bloginfo('url');?>" /> </td>
                                                <td>[Domain]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Business Name:','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-business-name" value="<?php echo !empty($lp_general['business'])? stripslashes($lp_general['business']):'';?>" /> </td>
                                                <td>[Business Name]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Phone:','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-phone" value="<?php echo !empty($lp_general['phone']) ? $lp_general['phone']:'';?>" /> </td>
                                                <td>[Phone]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Street:','wplegalpages'); ?></b></td>
                                                <td>
                                                    <input type="text" name="lp-street" value="<?php echo !empty($lp_general['street'])? $lp_general['street']:'';?>" /> </td>
                                                <td>[Street]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('City, State, Zip code:','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-city-state" value="<?php echo !empty($lp_general['cityState'])? stripslashes($lp_general['cityState']):'';?>" /> </td>
                                                <td>[City, State, Zip code]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Country:','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-country" value="<?php echo !empty($lp_general['country'])? $lp_general['country']:'';?>" /> </td>
                                                <td>[Country]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Email:','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-email" value="<?php echo !empty($lp_general['email'])?$lp_general['email']:get_option('admin_email');?>" /> </td>
                                                <td>[Email]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Full Mailing Address:','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-address" value="<?php echo !empty($lp_general['address'])?stripslashes($lp_general['address']):'';?>" /> </td>
                                                <td>[Address]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Niche:','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-niche" value="<?php echo !empty($lp_general['niche'])? stripslashes($lp_general['niche']):'';?>" /> </td>
                                                <td>[Niche]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Facebook URL:','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-facebook-url" value="<?php echo !empty($lp_general['facebook-url'])? stripslashes($lp_general['facebook-url']):'';?>" /> </td>
                                                <td>[Facebook-url]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Google URL:','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-google-url" value="<?php echo !empty($lp_general['google-url'])? stripslashes($lp_general['google-url']):'';?>" /> </td>
                                                <td>[Google-url]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('Twitter URL:','wplegalpages')?> </b></td>
                                                <td>
                                                    <input type="text" name="lp-twitter-url" value="<?php echo !empty($lp_general['twitter-url'])? stripslashes($lp_general['twitter-url']):'';?>" /> </td>
                                                <td>[Twitter-url]</td>
                                            </tr>
                                            <tr>
                                                <td><b><?php _e('LinkedIn URL:','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-linkedin-url" value="<?php echo !empty($lp_general['linkedin-url'])? stripslashes($lp_general['linkedin-url']):'';?>" /> </td>
                                                <td>[LinkedIn-url]</td>
                                            </tr>
                                            <tr>
                                                <td> <b><?php _e('Show legal pages in Search : ','wplegalpages')?></b> </td>
                                                <td>
                                                    <label class="switch">
                                                        <input type="checkbox" <?php echo (isset($lp_general[ 'search']) && $lp_general[ 'search']=='1' )? 'checked="checked"': '' ?> name="lp-search" value="1" >
                                                        <div class="slider round"></div>
                                                    </label>
                                                </td>
                                            </tr>

                                            <tr>
                                                <td><b><?php _e('Affiliate Disclosure :','wplegalpages')?> </b></td>
                                                <td>
                                                    <label class="switch">
                                                        <input type="checkbox" <?php echo (isset($lp_general[ 'affiliate-disclosure']) && $lp_general[ 'affiliate-disclosure']=='1' )? 'checked="checked"': '' ?> name="lp-affiliate-disclosure" value="1" >
                                                        <div class="slider round"></div>
                                                    </label>
                                                </td>
                                                <td>
                                                    <a href="#" data-toggle="tooltip" data-placement="right" title="If you have an affiliate site, having an affiliate disclosure is must.">
                                                        <!-- When a visitor clicks on leave, he/she will be redirected to this url. --><span class="glyphicon glyphicon-info-sign"></span> </a>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td> <b><?php _e('Adult Content Site : ','wplegalpages')?></b> </td>
                                                <td>
                                                    <label class="switch">
                                                        <input type="checkbox" <?php echo (isset($lp_general[ 'is_adult']) && $lp_general[ 'is_adult']=='1' )? 'checked="checked"': '' ?> id="lp-is_adult" name="lp-is_adult" value="1" >
                                                        <div class="slider round"></div>
                                                    </label>
                                                </td>
                                                <td>
                                                    <a href="#" data-toggle="tooltip" data-placement="right" title="If you enable this, a popup will display the first time a user visits your website. Each visitor will be forced to confirm that he/she is above his/her country's legal age limit. "> <span class="glyphicon glyphicon-info-sign"></span> </a>
                                                </td>
                                            </tr>


                                        <?php
                                            if(isset($lp_general['is_adult'])) {
                                                if($lp_general['is_adult'] == 1)
                                                echo '<tr id="exit_url_section">';
                                                else
                                                echo '<tr id="exit_url_section" style="display:none;">';
                                            } else {
                                                echo '<tr id="exit_url_section" style="display:none;">';
                                            }
                                            ?>
                                           
                                                <td><b><?php _e('Exit Url on Leave click :','wplegalpages')?></b></td>
                                                <td>
                                                    <input type="text" name="lp-leave-url" value="<?php echo !empty($lp_general['leave-url'])?$lp_general['leave-url']:'';?>" /> </td>
                                                <td>
                                                    <a href="#" data-toggle="tooltip" data-placement="right" title="If visitor clicks on 'Leave' button then he/she redirects to this URL.">
                                                        <!-- When a visitor clicks on leave, he/she will be redirected to this url. --><span class="glyphicon glyphicon-info-sign"></span> </a>
                                                </td>
                                                 
                                              
<!----------------------------------------Gdprs custom code start-------------------------------->  
                                           <!--  <tr>
                                                    <td> <b> <?php _e('GDPR :','wplegalpages')?> </b> </td>
                                                    <td>
                                                        <label class="switch">
                                                            <input type="checkbox" id="gdpr_btn" <?php echo (isset($lp_general[ 'gdprs']) && $lp_general[ 'gdprs']=='1' )? 'checked="checked"': '' ?> name="lp-gdprs" value="1" >
                                                            <div class="slider round"></div>
                                                        </label>
                                                    </td>
                                                    <td>
                                                        <a href="#" data-toggle="tooltip" data-placement="right" title="If you enable this,GDPR POpUp Will Display."> <span class="glyphicon glyphicon-info-sign"></span> </a>
                                                      </td> 
                                                     </tr>
                                               
                                                 
                                                    
                                                    <tr class="gdpr_text <?php echo $class;?>">
                                                   <td><b><?php _e('GDPR-BUTTON:','wplegalpages')?></b>
                                                 </td>

                                                    <?php
                                                      
                                                      $gdpr_button_val = $lp_general['gdpr_button_val'];

                                                       if($gdpr_button_val!=''){

                                                        $gdpr_button_val = $gdpr_button_val;
                                                       }
                                                       
                                                       else {

                                                       $gdpr_button_val = "OK, I understand";
                                                       }
                                                     
                                                     ?>
                                                 <td>
                                                    <input type="text"  name="lp-gdprbtnval" value="<?php echo !empty($gdpr_button_val)?$gdpr_button_val:get_option('gdpr_button_val');?>" /> </td>

                                              </tr>
                                          
                                              
                                                <tr  class="gdpr_text <?php echo $class;?>"> 
                                                 <td><b><?php _e('GDPR-CONTENT:','wplegalpages')?></b> 
                                                <td >
                                          
                                             <?php 
                                             $data ="";
                                             
                                             if(!empty( $lp_general['article_content']))
                                             {
                                              $data = $lp_general['article_content'];
                                             }
                                             else{
                                                $data = get_option('article_content');
                                             }

                                             if($data !='')
                                             {
                                              $data = $data;
                                             }
                                             else{
                                                $data = "Our site uses cookies. By continuing to use our site you are agreeing to our Cookie Policy";
                                             }

                                              $settings = array(
                                             $content = $data,
                                            'quicktags' => array('buttons' => 'em,strong,link'),
                                            'media_buttons' => false,
                                            'editor_height' => 5, 
                                           'textarea_rows' => 2,
                                            
                                             
                                             );


                                        wp_editor( $content, 'article_content', $settings );   ?>
                                                </td>    

                                              </tr>   -->

<!----------------------------------------Gdprs custom code End-------------------------------->  
                                               
                                               
                                        </table>
                                        <br/>
                                        <p>
                                            <input type="submit" name="lp-gsubmit" class="btn btn-primary" value="<?php _e('Save','wplegalpages')?>" />
                                            <input type="submit" class="btn btn-primary" name="lp-greset" value="<?php _e('Reset','wplegalpages')?>" /> </p>
                                    </form>
                                </div>
                            </div> <a href="<?php echo esc_url(get_bloginfo('url'));?>/wp-admin/admin.php?page=lp-create"><h3 class="hndle"  style="cursor:pointer; padding:7px 10px; font-size:20px;">Click Here to Create Legal Pages &raquo;</h3></a>
                            <?php }else{
    ?>
                                <h2 class="hndle title-head"><?php _e('DISCLAIMER','wplegalpages')?></h2>
                                <form action="" method="post">
                                    <textarea rows="20" cols="130"><?php _e('Our Wordpress plugin and the documents or pages that it may provide, are made available on the condition that you accept the following terms, and any other terms or disclaimers that may be provided. 

You may not use or post any of the templates or legal documents until and unless you have agreed. PLEASE NOTE: We are not licensed attorneys and do not purport to be. 

This plugin is not a law firm, is not comprised of a law firm, and its employees are not lawyers. We in no way intend to represent a legal law firm in any way.

 We do NOT review your site and we will not review your site at any time. 

We do not purport to act as your attorney and do not make any claims that would constitute legal advice. 

We do not practice law in any state, nor are any of the documents provided via our Site intended to be in lieu of receiving legal advice.

 The information we may provide is general in nature, and may be different in your jurisdiction. In other words, do not take these documents to be "bulletproof" or to give you protection from lawsuits. Use acordingly.

They are not a substitute for legal advice and you should have an attorney review them. Accordingly, we disclaim any and all liability and make no warranties, including disclaimer of warranty for implied purpose, merchantability, or fitness for a particular purpose. We provide these documents on an as is basis, and offer no express or implied warranties. 

The use of our plugin and its related documents is not intended to create any representation or approval of the legality of your site and you may not represent it as such. We will have no responsibility or liability for any claim of loss, injury, or damages related to your use or reliance on these documents, or any third parties use or reliance on these documents.

 They are to be used at your own risk. Your only remedy for any loss or dissatisfaction with WP-Legal Eagle is to discontinue your use of the service and remove any documents you may have downloaded. To the degree that we have had a licensed attorney review these documents it is for our own internal purposes and you may not rely on this as legal advice. 

Since the law is different in every state, and you are concerned with anything you are unsure of, you should have these documents reviewed by an attorney in your local jurisdiction. As stated,  we disclaim any and all liability and warranties, including damages or loss that may result from your use or misuse of the documents. Unless prohibited or limited by law, our damages in any matter are limited to the amount you paid for the WP- Legal Eagle wordpress plugin.

Thank you for your continued support! ','wplegalpages')?></textarea>
                                    <br/>
                                    <br/><p style="font-weight: bold;" class="please-tick"><?php _e('Please Tick this checkbox to accept our Terms and Policy','wplegalpages')?> <input type="checkbox" name="lp_accept_terms" value="1" <?php if($lpterms==1) { echo "checked"; }?> onclick="jQuery('#lp_submit').toggle();"/></p>
                                    
                                    <br/>
                                    <br/>
                                    <input type="submit" name="lp_submit" id="lp_submit" class="btn btn-primary" style="display:none;" value="Accept" /> </form>
                                <?php
}







?>


