PHP Classes

File: src/wikiloc.js

Recommend this page to a friend!
  Classes of Ali YILMAZ   PHP Wikiloc   src/wikiloc.js   Download  
File: src/wikiloc.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Wikiloc
Validate Wikiloc URL pages and extract map IDs
Author: By
Last change:
Date: 4 months ago
Size: 1,969 bytes
 

Contents

Class file image Download
function isWikilocTrailValidation(link){ const trailPageRegex = /^(https?:\/\/)(.*\.)?\wikiloc\.com\/([^\/]+)\/(.*)/; var match = link.match(trailPageRegex); if(match != null){ let scheme = match['input'].split('/'); const rawId = scheme[4].split('').reverse().join('').split('-'); if(rawId[0] != NaN && rawId[0] != '' && rawId[0] != undefined){ return true; } } return false; } function getWikilocTrailId(link){ const trailPageRegex = /^(https?:\/\/)(.*\.)?\wikiloc\.com\/([^\/]+)\/(.*)/; var match = link.match(trailPageRegex); if(match != null){ let scheme = match['input'].split('/'); const rawId = scheme[4].split('').reverse().join('').split('-'); if(rawId[0] != NaN && rawId[0] != '' && rawId[0] != undefined){ return rawId[0].split('').reverse().join(''); } } return null; } function isWikilocTrailMapValidation(link) { const trailMapRegex = /^(https?:\/\/)(.*\.)?\wikiloc\.com\/wikiloc\/embedv2\.do\?id=[0-9]+&elevation=(on|off)&images=(on|off)&maptype=(H|S)/; var match = link.match(trailMapRegex); if(match != null){ let trailMapScheme = match['input'].split('/'); const trailRawId = trailMapScheme[4].split('&'); const Id = trailRawId[0].split('=')[1]; if(Id[0] != NaN && Id[0] != '' && Id[0] != undefined){ return true; } } return false; } function getWikilocTrailMapId(link) { const trailMapRegex = /^(https?:\/\/)(.*\.)?\wikiloc\.com\/wikiloc\/embedv2\.do\?id=[0-9]+&elevation=(on|off)&images=(on|off)&maptype=(H|S)/; var match = link.match(trailMapRegex); if(match != null){ let trailMapScheme = match['input'].split('/'); const trailRawId = trailMapScheme[4].split('&'); const Id = trailRawId[0].split('=')[1]; if(Id[0] != NaN && Id[0] != '' && Id[0] != undefined){ return Id; } } return null; }