Plugin Directory

Changeset 717129


Ignore:
Timestamp:
05/23/2013 06:57:43 AM (13 years ago)
Author:
Sanskript
Message:

Integrate WalkScore
Update lic server

Location:
soldpress/branches/0.9.5A
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • soldpress/branches/0.9.5A/license.php

    r715843 r717129  
    11 
    22<?php
    3 
    4 
    5 // Our Intention here is not create a sophistcard licsening model.
    6 // We a build a number of extention that will help enchance your delivery to end client.
    7 // The plugin still does excatly what it is inteneded for.
    8         $domain = "www.sanskript.com";
    9  
    10         //WP Function Like: get_option('stpopup-license');, Joomla! Function Like: $this->params->get('license');, OR  $_POST['key'];.
    11         //$licensekey = $_POST['key'];
     3   
     4    function CheckLic(){
     5   
     6        $domain = "beta.sanskript.com";
     7       
    128        $licensekey = get_option('sp-license');
    139        //Must same with product registered stored on DataBase
    1410        $prod_id = "SOLDPRESS-BETA";
    1511
    16         if (substr($domain, 0, 4) == "www.") { $domain = substr($domain, 4);}
     12        if (substr($domain, 0, 4) == "www.") {
     13            $domain = substr($domain, 4);
     14        }
    1715        $userip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
    1816        $validdir = dirname(__FILE__);
     
    2624        $key_info['product'] = $prod_id;
    2725
    28         $serverurl = "http://www.sanskript.com/"; // Your Blog URL Where WLS Installed
     26        $content = json_encode($key_info);
     27        //var_dump($content);
    2928        $ch = curl_init();
    30         curl_setopt($ch, CURLOPT_URL, $serverurl."wp-content/plugins/wp-licensing/auth/verify.php");
     29        curl_setopt($ch, CURLOPT_URL,"http://www.sanskript.com/svc/twistoid/1/api/license");
     30        curl_setopt($ch, CURLOPT_HTTPHEADER,array("Content-type: application/json"));
    3131        curl_setopt($ch, CURLOPT_POST, 1);
    32         curl_setopt($ch, CURLOPT_POSTFIELDS, $key_info);
     32        curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
    3333        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    3434        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    3535        $result = curl_exec($ch);
    3636        curl_close($ch);
    37 
    38     $result = json_decode($result, true);
    39    
    40     if($result['valid'] == "true"){
    41         // key is valid so run it
    42         echo "<p>Your license key is valid,<br>Thank you"; // Place your protected code function here
     37        var_dump($result);
     38        $result = json_decode($result, true);
    4339       
    44         //If Beta Enable The Beta Flag and Debug Flag
    45         set_option('sp-license-valid',"asdfhjasldfalsdfj29349023jasldfj");
    46     } else {
    47         // key is not valid so stop it
    48         echo '<div class="updated"><p>Your license key is Invalid! Test of the license server</p></div>';
     40        if($result['valid'] == "true"){
     41            // key is valid so run it
     42            echo "<p>Your license key is valid,<br>Thank you"; // Place your protected code function here
     43           
     44            //If Beta Enable The Beta Flag and Debug Flag
     45            set_option('sp-license-valid',"asdfhjasldfalsdfj29349023jasldfj");
     46        } else {
     47            // key is not valid so stop it
     48            echo '<div class="updated"><p>Your license key is Invalid! Test of the license server</p></div>';
     49        }
    4950    }
    5051
  • soldpress/branches/0.9.5A/single-sp_property.php

    r716478 r717129  
    6060        <div class="row">
    6161                <div class="span4"><img src="<?php echo plugins_url( 'images/realtor.jpg' , __FILE__ ); ?>"> <img src="<?php echo plugins_url( 'images/mls.jpg' , __FILE__ ); ?>"> </div>   
    62                 <div class="span4 pull-right">  <div  class="pull-right" style="position: relative; width:160px; height: 40px; background: url(http://cdn2.walk.sc/images/widget/back-blue3.gif) top left no-repeat;overflow:hidden;border:0;outline:0;margin:0;padding:0;">  <h1 style="position: absolute; left: 125px; top: 4px;border:0;outline:0;margin:0;padding:0;text-align: left; text-decoration:none; font-style: normal; vertical-align: baseline; background: none;font:16px 'trebuchet ms', Geneva, Arial, Helvetica, sans-serif; font-weight: bold; color:#4b76c6;">33</h1>  <p style="position: absolute; left: 8px; top: 25px;border:0;outline:0;margin:0;padding:0;text-align: left; text-decoration:none; font-style: normal; vertical-align: baseline; background: none;font: 11px/11px Verdana, Arial, Helvetica, sans-serif; font-weight: normal; color: #666; vertical-align: top;width: 152px; text-align: center;"><span style="background-color: #eff4ff; padding:0 2px;">Car-Dependent</span></p>  <a href="http://www.walkscore.com/score/<?php echo get_post_meta($post->ID,'dfd_UnparsedAddress',true); ?> , <?php echo get_post_meta($post->ID,'dfd_StateOrProvince',true); ?> <?php echo get_post_meta($post->ID,'dfd_PostalCode',true); ?>?utm_medium=overlay_link&utm_campaign=widget3" target="_blank" style="position:absolute;top:0;left:0;display:block;background:url(http://www.walkscore.com/images/fulltrans.png) 0 0 repeat;z-index:5;text-indent:-999999px;width:160px;height:40px;border:0;outline:0;margin:0;padding:0;">Walk Score</a></div></div>
    63         </div>         
    64 
    65         <?php
    66             /*   function getWalkScore($lat, $lon, $address) {
     62                <div class="span4 pull-right">  <?php
     63                 function getWalkScore($lat, $lon, $address) {
     64                 
     65                  //Call Google To Get Lat and Long
    6766                  $address=urlencode($address);
    68                   $url = "http://api.walkscore.com/score?format=json&address=$address";
    69                   $url .= '&lat=$lat&lon=$lon&wsapikey="'. get_option('sc-layout-walkscore',true).'"';
    70                   $str = @file_get_contents($url);
    71                   return $str;
     67                  $googleapiurl = "http://maps.googleapis.com/maps/api/geocode/json?address=$address&sensor=false";
     68                  $geo = @file_get_contents($googleapiurl);
     69                 
     70                  $result = json_decode($geo, true);
     71                  //var_dump($result);
     72                  if($result['status'] == 'OK'){
     73                   
     74                      $location = $result['results'][0]['geometry']['location'];
     75                      $lat = $location['lat'];
     76                      $lon = $location['lng'];
     77                      //Let Record Lat and Long For Future Requests
     78                     
     79                     
     80                      $url = "http://api.walkscore.com/score?format=json&address=$address";
     81                      $url .= '&lat=' . $lat . '&lon=' . $lon . '&wsapikey='. get_option('sc-layout-walkscore',true);
     82                    //  echo $url;
     83                      $str = @file_get_contents($url);
     84                      return $str;               
     85                  }
    7286                 }
    73 
     87               
    7488                 $lat = $_GET['lat'];
    7589                 $lon = $_GET['lon'];
     
    7791                 $json = getWalkScore($lat,$lon,$address);
    7892                 
    79                  echo $json;*/
    80         ?>
     93
     94                $result = json_decode($json, true);
     95                 if($result["status"] == '1')
     96                 {
     97                    $walkscore = '<div id="walkscore-div pull-right"><p><a target="_blank" href="'. $result["ws_link"].'"><img src="'. $result["logo_url"].'"><span class="walkscore-scoretext">'. $result["walkscore"].'</span></a><span id="ws_info"><a href=". $result["more_info_link"]." target="_blank"><img src="'. $result["more_info_icon"].'" width="13" height="13" "=""></a></span></p></div>';
     98                    echo $walkscore;
     99                 }
     100                 
     101        ?></div>
     102        </div>         
     103
     104       
    81105   
    82106    </div> 
Note: See TracChangeset for help on using the changeset viewer.