Facebook
From ricky, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 307
  1. <?php
  2. function android_ecommerce_admin_notices(){
  3.        
  4.         include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
  5.        
  6.         if ( is_plugin_active('woocommerce/woocommerce.php') == false ) {
  7.                 echo '<div id="message" class="error fade"><p style="line-height: 150%">';
  8.                 _e('<strong>VC App Settings & Checkout</strong></a> requires the WooCommerce to be activated. Please <a target="_blank" href="plugin-install.php?tab=plugin-information&plugin=woocommerce&TB_iframe=true&width=600&height=550">install / Activate</a> first.', 'VC App');
  9.                 echo '</p></div>';
  10.                 return;
  11.         }      
  12.        
  13.         if ( is_plugin_active( 'json-api/json-api.php' ) == false ) {
  14.                 echo '<div id="message" class="error fade"><p style="line-height: 150%">';
  15.                 _e('<strong>VC App Settings & Checkout</strong></a> requires the JSON API plugin to be activated. Please <a target="_blank" href="plugin-install.php?tab=plugin-information&plugin=json-api&TB_iframe=true&width=600&height=550">install / Activate </a> first.', 'VC App');
  16.                 echo '</p></div>';             
  17.                 return;
  18.         }
  19. }
  20.  
  21. function android_ecommerce_add_app_admin_menu() {      
  22.     add_menu_page( __( 'Android Ecommerce Banner Settings' ), __( 'Android Ecommerce Banner Settings' ), 'manage_options', 'android-banner-settings', 'android_ecommerce_app_banner_setting', '' , 64 );       
  23. }
  24.  
  25. function android_ecommerce_add_app_admin_menu_activation() {   
  26.     add_menu_page( __( 'Android Ecommerce Activate' ), __( 'Android Ecommerce Activate' ), 'manage_options', 'android-banner-activate', 'android_ecommerce_activate', '' , 64 );       
  27. }
  28.  
  29.  
  30. function android_curl( $url ) {
  31.                 if ( empty( $url) ) return false;
  32.                 $ch = curl_init();
  33.                 curl_setopt($ch, CURLOPT_URL, $url);
  34.                 curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
  35.                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  36.                 curl_setopt($ch, CURLOPT_VERBOSE, true);
  37.                 $result_cal = curl_exec($ch);
  38.                 curl_close($ch);
  39.                 return $result_cal;            
  40. }
  41.  
  42.  
  43. function android_ecommerce_activate(){ ?>
  44.  
  45. <div class="wrap">
  46.   <style>
  47.                 #poststuff .inside {
  48.                         margin: 6px 0 0;
  49.                 }
  50.                
  51.                 #newImageButton { background:#ccc; box-shadow:none; }
  52.                        
  53.                 .stuffbox label {
  54.                         line-height: 20px;
  55.                         font-size: 12px;
  56.                         text-align: left;
  57.                         padding: 0 15px 10px;
  58.                         font-weight: 700;
  59.                 }
  60.                
  61.                 .inside input,
  62.                 .inside select {
  63.                         width: 50%;
  64.                         height: 35px;
  65.                         box-shadow: none;
  66.                         background: #fff;
  67.                 }
  68.                
  69.                 #poststuff {
  70.                         padding-top: 10px;
  71.                         width: 100%;
  72.                         padding: 0 10px;
  73.                 }
  74.                
  75.                 #poststuff .stuffbox>h3,
  76.                 #poststuff h2,
  77.                 #poststuff h3.hndle {
  78.                         font-size: 14px;
  79.                         padding: 8px 12px;
  80.                         margin: 0;
  81.                         line-height: 1.4;
  82.                 }
  83.                
  84.                 .postbox,
  85.                 .stuffbox {
  86.                         margin-bottom: 20px;
  87.                         padding: 0;
  88.                         line-height: 1;
  89.                         background: #fff;
  90.                         padding: 8px 0 0 0;
  91.                 }
  92.                
  93.                 #poststuff {
  94.                         width: 70%;
  95.                         background: #fff;
  96.                         padding: 20px;
  97.                 }
  98.                
  99.                 #poststuff h4 {
  100.                         font-size: 18px;
  101.                 }
  102.                
  103.                 .msg {
  104.                         color: #ff0000;
  105.                         text-align: center;
  106.                         font-size: 12px;
  107.                         line-height: 20px;
  108.                 }
  109.                 .bps {padding:2px 20px!important; height:34px!important;}
  110.                 @media only screen and (max-device-width : 768px) {
  111.                         #poststuff {width: 94%; padding: 20px 3%;}
  112.                         .inside input, .inside select { width: 100%; }                         
  113.                 }      
  114.                
  115.                
  116.         </style>
  117.   <?php
  118.                 $api_url = 'http://api.themes-coder.com';
  119.                 if(isset($_REQUEST['purchase_code']) && $_REQUEST['purchase_code'] != ""){                     
  120.                         $purchase_code   = $_REQUEST['purchase_code'];                         
  121.                         $purchase_code   = urlencode( $purchase_code );
  122.                         $current_site_url =     get_site_url();
  123.                         $url = $api_url . '/api.php?code=' . $purchase_code."&url=".$current_site_url;                 
  124.                 $response =     android_curl( $url );
  125.                         $response = json_decode( $response, true );
  126.                         var_dump($response);
  127.                        
  128.                         if(isset($response['error']) && $response['error'] == '404'){
  129.                                  //$msg = $response['description'];
  130.                                  update_option('android_ecommerce_purchase_code' , $purchase_code);
  131.                                 update_option('android_ecommerce_plugin_active' , 'active');
  132.                                 update_option('android_ecommerce_purchase_detail' , $response);
  133.                                 echo "<script>window.location.href='admin.php?page=android-ecommerce'</script>";
  134.                         }elseif(isset($response['purchase_code']) && $response['purchase_count'] >= 1 && $response['buyer'] != "" ){
  135.                                 update_option('android_ecommerce_purchase_code' , $purchase_code);
  136.                                 update_option('android_ecommerce_plugin_active' , 'active');
  137.                                 update_option('android_ecommerce_purchase_detail' , $response);
  138.                                 echo "<script>window.location.href='admin.php?page=android-ecommerce'</script>";
  139.                         }                      
  140.                 }  
  141.  
  142.                 if(get_option('android_ecommerce_plugin_active') == "active" && get_option('android_ecommerce_purchase_code') != ""){                  
  143.                         $android_ecommerce_purchase_code        = get_option('android_ecommerce_purchase_code');
  144.                         $android_ecommerce_plugin_active  = get_option('android_ecommerce_plugin_active');
  145.                 }                      
  146.   ?>
  147.   <h1 class="wp-heading-inline">Plugin Validation</h1>
  148.   <?php if(isset($msg) && $msg != ""){ ?>
  149.   <div id="message" class="notice notice-error is-dismissible">
  150.     <p><?php echo $msg; ?>. </p>
  151.   </div>
  152.   <?php } ?>
  153.   <div class="poststuff" id="poststuff">
  154.     <form method="post" action="" id="plugin_validate" name="plugin_validate">
  155.       <div class="stuffbox">
  156.         <label for="name" class="col-sm-2 col-md-3 control-label">Please Enter Purchase Code </label>
  157.         <div class="inside">
  158.           <input required class="form-control field-validate" id="purchase_code" name="purchase_code" type="text" value="<?php if(isset($android_ecommerce_purchase_code) && $android_ecommerce_purchase_code != ""){ echo $android_ecommerce_purchase_code; } ?>">
  159.           <br />
  160.           <span class="help-block" style="font-weight: normal;font-size: 11px;margin-bottom: 0;">Enter Product Purchase Code.</span> </div>
  161.       </div>
  162.       <?php wp_nonce_field('action_settings_add_edit','add_edit_nonce'); ?>
  163.       <div>
  164.         <?php if(!isset($android_ecommerce_purchase_code) && $android_ecommerce_purchase_code == ""){ ?>
  165.         <button type="submit" name="submit" id="btnsave" value="Submit" class="button-primary bps">Submit</button>
  166.         &nbsp;&nbsp;
  167.         <button type="button" name="button" onclick="location.href='admin.php?page=android-ecommerce-activate'" id="btnsave" value="true" class="button-primary bps">Cancel</button>
  168.         <?php } else {?>
  169.         <a href="admin.php?page=android-ecommerce"  id="btnsave"  class="button-primary">Settings</a>
  170.         <?php } ?>
  171.       </div>
  172.     </form>
  173.   </div>
  174. </div>
  175. <?php }
  176.  
  177.  
  178.  
  179.  
  180. function android_ecommerce_wp_rest_allow_all_cors() {
  181.  remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
  182.   add_filter( 'rest_pre_serve_request', function( $value ) {
  183.         header("Cache-Control: no-cache, must-revalidate");
  184.         header('Access-Control-Allow-Origin:  *');
  185.         header('Access-Control-Allow-Methods:  POST, GET, OPTIONS, PUT, DELETE');
  186.         header('Access-Control-Allow-Headers:  Content-Type, X-Auth-Token, Origin, Authorization');
  187.          
  188.                 return $value;
  189.   });
  190. }
  191.  
  192. function android_ecommerce_my_app_hook() {
  193.    if(isset($_GET['mob']) && $_GET['mob'] == true ){?>
  194.     <style>
  195.                 <?php if(isset($_GET['platform']) && $_GET['platform'] == 'ios' ) {
  196.                  echo "body{padding-top:50px;}";
  197.                 }
  198.                  global $wpdb;
  199.                  $all_settings = get_option( 'android_ecommerce_app_settings');
  200.                  $custom_css_for_checkout = $all_settings['custom_css_for_checkout'];
  201.                  echo $custom_css_for_checkout;
  202.                  ?>
  203.         </style>
  204.                 <?php if(isset($_GET['one_page']) && $_GET['one_page'] == 2 ){?>
  205.                 <script>  
  206.                         jQuery( document ).ready( readyFn );
  207.                         function readyFn( jQuery ) { jQuery("#place_order").trigger('click'); }
  208.                 </script>
  209.                 <style>
  210.                         body , .checkout {
  211.                                 display: none;
  212.                         }
  213.                 </style>
  214.     <?php }} add_filter( 'woocommerce_ship_to_different_address_checked', '__return_true'); } ?>

Replies to codelist rss

Title Name Language When
Re: codelist mamun text 2 Years ago.
Re: codelist Silly Flamingo text 2 Years ago.
Re: codelist Harmless Stork text 3 Years ago.
Re: codelist Burly Coyote text 3 Years ago.