Skip to content

Instantly share code, notes, and snippets.

@salami-art
Created December 17, 2020 10:58
Show Gist options
  • Save salami-art/53edfb0c76931464e299422fc055cfac to your computer and use it in GitHub Desktop.
Save salami-art/53edfb0c76931464e299422fc055cfac to your computer and use it in GitHub Desktop.
<?php
require_once('../../obj/XmlGeocms.php');
require_once('../../obj/Geo.php');
require_once('../../input/stream/Stream.php');
require_once('config.php');
$requestURI = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
$requestURI = explode("/", $requestURI);
$app = $requestURI[4];
if(empty($app)){ echo "app number is empty!"; die(); }
// I create a new istance of XML for Geocms
$xg = new XmlGeocms('facilities','update');
//$poi = new Geo();
$stream = new Stream();
$obj = $stream->get('editore','pdi',$app);
$i = 0;
foreach($obj as $pdi){
//$i++; if($i>10) break;
/* PROCEDURA SE VOGLIO DATI GEOCMS
$poi = $poigeocms->data->main; */
/* PROCEDURA SE VOGLIO AGGIORNARE COI DATI EDITORE */
$poi = new Geo();
$poi->import('editore',$pdi);
$poi->scube_id = '';
$poi->tags = str_replace('Agriturismo','agriturismo',$poi->tags);
$poi->tags = str_replace('taxi','Taxi',$poi->tags);
$poi->tags = str_replace('Parcheggio','parcheggio',$poi->tags);
$poi->tags = str_replace('Porto','porto',$poi->tags);
$poi->tags = str_replace('servizi di navigazione','Servizi di navigazione',$poi->tags);
$poi->tags = str_replace('Porti turistici','porti turistici',$poi->tags);
/* Custom sources */
if($app>=151 && $app < 176)
$poi->source = "TE_parchi";
if($app>=127)
$poi->source = "TE_appdelgusto";
/* if (strpos($poi->tags, 'agriturismo') !== false
|| strpos($poi->tags, 'Taxi') !== false
|| strpos($poi->tags, 'parcheggio') !== false
|| strpos($poi->tags, 'porto') !== false
|| strpos($poi->tags, 'porti turistici') !== false
|| strpos($poi->tags, 'osteria') !== false
|| strpos($poi->tags, 'trattoria') !== false
)*/
$xg->addElement( $poi);
}
$xg->output();
//$xg->outputFile("poi_".$app,LOCAL_PATH);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment