Plugin Directory

Changeset 2765374


Ignore:
Timestamp:
08/02/2022 07:41:09 PM (4 years ago)
Author:
expantours
Message:

version 1.6
added transcient cache to api call

Location:
expan-pro
Files:
13 added
2 edited

Legend:

Unmodified
Added
Removed
  • expan-pro/trunk/index.php

    r2628749 r2765374  
    44 * Plugin URI: https://www.expan.cl
    55 * Description: This plugin is designed to use the Expan Pro service associated with your user account created by Expan Tours.
    6  * Version: 1.5
     6 * Version: 1.6
    77 * Author: Expan Team
    88 * Text Domain: expanpro
     
    3434    );
    3535
    36      $url = "https://api.expan.pro";
    37     //$url = "https://expanpro.test";
    38 
    39     $response = wp_remote_get($url . '/api/share/trip_plan_api', $args);
    40 
    41     //echo '<h1>'.get_option('expanpro_token').'</h1>';
     36     //$url = "https://api.expan.pro";
     37     $url = "https://expanpro.test";
     38
     39    $attsstring = implode("-",$atts);
     40
     41    if(( $response = get_transient('expanpro-'.$attsstring)) === false)
     42    {
     43      $remote = wp_remote_get($url . '/api/share/trip_plan_api', $args);
     44      set_transient('expanpro-'.$attsstring, $remote, 360);
     45    }
     46
    4247
    4348    if ( is_array( $response ) && ! is_wp_error( $response ) ) :
     
    101106
    102107                   if($d['media']):
    103                      $idmedia = $d['media'][0]['id'];
    104                      $medios = $APIjson['media']['TripPlan'][$idmedia];
    105 
    106                       if($medios){
    107                         $mediaurl = $medios['conversions']['md'];
    108                         $medianame = $medios['name'];
    109                         $mediaid = $medios['id'];
    110 
    111                         if(!$mediaurl){
    112                           $imgurl = $medios['fullUrl'];
    113                         }else {
    114                           $imgurl = $mediaurl;
    115                         }
    116 
    117                       }
    118                       else{
    119                         $mediaurl = '';
    120                         $medianame = '';
    121                         $mediaid = '';
    122                         $imgurl = '';
    123                       }
    124 
    125                     $d['medios']['mediaurl'] = $mediaurl;
    126                     $d['medios']['medianame'] = $medianame;
    127                     $d['medios']['mediaid'] = $mediaid;
    128                     $d['medios']['imgurl'] = $imgurl;
     108                 
    129109                    $d['paises'] = $paises;
    130110                    $d['daynights'] = $daynights;
     
    328308
    329309       <?php
    330          $url = "https://api.expan.pro";
    331          //$url = "https://expanpro.test";
     310         //$url = "https://api.expan.pro";
     311         $url = "https://expanpro.test";
    332312         $response = wp_remote_post( $url . '/api/auth/loginweb/?email='.esc_attr( get_option('expanpro_email') ).'&password='.esc_attr( get_option('expanpro_password') ) , array() ) ;
    333313
     314        // echo '<h1>'.get_option('expanpro_token').'</h1>';
     315         
    334316        if ( is_array( $response ) && ! is_wp_error( $response ) ) :
    335317            $headers = $response['headers']; // array of http header lines
     
    348330                 }else{
    349331                   echo '<div class="notice notice-error">
    350                        <p> '.__("Failed to connect, try another password", "expanpro").' </p>
     332                       <p> Fallo al ingresar contraseña, intente nuevamente </p>
    351333                     </div>';
    352334                 }
     
    356338
    357339                echo '<div class="notice notice-error">
    358                     <p> '.__("Failed to connect, try another password", "expanpro").' </p>
     340                    <p> Fallo al conectar, intente nuevamente </p>
    359341                  </div>';
    360342              }
    361343            }else{
    362344              echo '<div class="notice notice-error">
    363                   <p> '.__("Failed to connect, try another password", "expanpro").' </p>
     345                  <p>Fallo al conectar, intente nuevamente </p>
    364346                </div>';
    365347            }
  • expan-pro/trunk/readme.txt

    r2628749 r2765374  
    7575== Changelog ==
    7676
     77= 1.6 =
     78* Cached API Call.
     79
    7780= 1.5 =
    7881* New custom domain option.
Note: See TracChangeset for help on using the changeset viewer.