Plugin Directory

Changeset 1328633


Ignore:
Timestamp:
01/14/2016 10:48:16 PM (10 years ago)
Author:
solidearth
Message:

Changed sites to be taken from Spring API insted of being static

File:
1 edited

Legend:

Unmodified
Added
Removed
  • solid-earth-spring-api/trunk/menu.php

    r1268955 r1328633  
    6262    <form action="" method="POST">
    6363
    64       <br><br>'. SPRINGAPIWP_siteSelect($data['sitename']) . '
     64      <br><br>'. SPRINGAPIWP_siteSelect($data['sitename'], $data['api_key']) . '
    6565
    6666      <h2 style="display: inline;">API Key:</h2>
     
    202202    <form method="POST">
    203203
    204       <br><br>' . SPRINGAPIWP_siteSelect($siteValue) . '
     204      <br><br>' . SPRINGAPIWP_siteSelect($siteValue, $data['api_key']) . '
    205205
    206206      <h2 style="display: inline;">API Key:</h2>
     
    340340    <form action="" method="POST">
    341341
    342       <br><br>' . SPRINGAPIWP_siteSelect($siteValue) . '
     342      <br><br>' . SPRINGAPIWP_siteSelect($siteValue, $data['api_key']) . '
    343343
    344344      <h2 style="display: inline;">API Key:</h2>
     
    434434    <form action="" method="POST">
    435435
    436       <br><br>' . SPRINGAPIWP_siteSelect($siteValue) . '
     436      <br><br>' . SPRINGAPIWP_siteSelect($siteValuem, $data['api_key']) . '
    437437
    438438      <h2 style="display: inline;">API Key:</h2>
     
    455455}
    456456
    457 function SPRINGAPIWP_siteSelect ( $curVal ) {
    458   $siteTypes = array('gbrar', 'gcar', 'mlsbox', 'tuscar', 'mibor', 'baarmls', 'sandicor', 'rafgc');
    459   $siteSelect = '<h2 style="display: inline;">Site Select:</h2>
     457function SPRINGAPIWP_siteSelect ( $curVal, $api_key ) {
     458   $json_url = "https://api.solidearth.com/v1/sites?format=json&api_key=".$api_key."";
     459    $json = file_get_contents($json_url);
     460    $data = json_decode($json, TRUE);
     461
     462    $siteTypes = array();
     463    foreach($data as $name){
     464        array_push($siteTypes, $name['site']);
     465    }
     466
     467
     468  //$siteTypes = array('gbrar', 'gcar', 'mlsbox', 'tuscar', 'mibor', 'baarmls', 'sandicor', 'rafgc');
     469    $siteSelect = '<h2 style="display: inline;">Site Select:</h2>
    460470  <p style="display: inline;">Choose the Market or Markets in which you or your customer have an MLS Membership.</p>
    461471  <br />
Note: See TracChangeset for help on using the changeset viewer.