{ Dev Farm }

Web & Windows Development

[How-To] Use wp-gpx-maps on a non-wordpress website

Home Forum Wp Gpx Maps Stand-alone [How-To] Use wp-gpx-maps on a non-wordpress website

  • Questo topic ha 13 risposte, 2 partecipanti ed è stato aggiornato l'ultima volta 1 mese, 2 settimane fa da max.
Stai visualizzando 14 post - dal 1 a 14 (di 14 totali)
  • Autore
    Post
  • #3059 Rispondi
    max
    Amministratore del forum

    The sample below show how to use wp-gpx-maps wordpress plugin outside wordpress.

    – Get latest plugin version: http://wordpress.org/extend/plugins/wp-gpx-maps/
    – unzip and place the plugin files
    – set the variables $uploadDir, $uploadUrl, $pluginDir, $gpxUrl
    – done!

    If you want a better code optimization you can directly edit the plugin files!

    N.B. Obviously NextGEN Gallery integration in not working and it throws exceptions!

    demo: https://devfarm.it/samples/wp-gpx-maps-stand-alone.php

    download source: https://devfarm.it/samples/wp-gpx-maps-stand-alone.php.txt

    <?php
    
    $sitePath = "../"; // or realpath('.');
    $uploadDir = $sitePath . "wp-content/uploads"; // Must be writable. The plugin will create the /gpx and /gpx/~cache subfolders
    $pluginDir = $sitePath . "wp-content/plugins/wp-gpx-maps/"; // wordpress plugin path
    
    $uploadUrl = "/wp-content/uploads/gpx/"; // gpx download path
    $gpxUrl = $uploadUrl . "Mountainbike.gpx"; // your gpx file
    
    /* wordpress function wrapper */
    function load_plugin_textdomain(){}
    function is_admin() {return false;}
    function add_action(){}
    function add_shortcode(){}
    function register_activation_hook(){}
    function register_deactivation_hook(){}
    function add_filter(){}
    function get_option(){return "";}
    function wp_upload_dir(){return Array ( "basedir" => $uploadDir ); }
    function plugins_url(){return $uploadUrl ;}
    function __($val){return $val;}
    
    include $pluginDir.'wp-gpx-maps.php';
    ?>
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>WP GPX Maps - standalone</title>
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="https://maps.googleapis.com/maps/api/js?sensor=false&v=3.9" type="text/javascript" ></script>
    <script src="http://code.highcharts.com/highcharts.js" type="text/javascript" ></script>
    <script src="<?php echo $pluginDir; ?>WP-GPX-Maps.js" type="text/javascript" ></script>
    <style type="text/css" media="screen">
    <?php
    echo print_WP_GPX_Maps_styles();
    ?>
    </style>
    </head>
    <body>
    <?php
    
    /*
    plugin call with all the possible settings
    more info here: http://wordpress.org/extend/plugins/wp-gpx-maps/faq/
    */
    
    echo handle_WP_GPX_Maps_Shortcodes( Array (
    "gpx"=> $gpxUrl,
    "width"=> "100%",
    "mheight"=> "450px",
    "mtype"=>"HYBRID",
    "gheight"=> "200px",
    "showcad"=>false,
    "showhr"=> false,
    "waypoints"=> false,
    "showspeed"=> true,
    "showgrade"=> true,
    "zoomonscrollwheel"=> false,
    "donotreducegpx"=> false,
    "pointsoffset"=> 10,
    "uom"=>"0",
    "uomspeed"=>"0",
    "mlinecolor"=>"#3366cc",
    "glinecolor"=>"#3366cc",
    "glinecolorspeed"=>"#ff0000",
    "glinecolorhr"=>"#ff77bd",
    "glinecolorcad"=>"#beecff",
    "glinecolorgrade"=>"#beecff",
    "chartfrom1"=>"",
    "chartto1"=>"",
    "chartfrom2"=>"",
    "chartto2"=> "",
    "starticon"=> "",
    "endicon"=> "",
    "currenticon"=> "",
    "waypointicon"=> "",
    "nggalleries"=> "",
    "ngimages"=>"",
    "download"=> "",
    "dtoffset"=> 0,
    "skipcache"=> "",
    "summary"=> "",
    "summarytotlen"=> true,
    "summarymaxele"=> true,
    "summaryminele"=> true,
    "summaryeleup"=>true,
    "summaryeledown"=> true,
    "summaryavgspeed"=> true,
    "summarytotaltime"=>true,
    ) );
    
    ?>
    
    </body>
    </html>

    #21620 Rispondi
    Belat
    Ospite

    Hi,

    I’m interested using the plugin outside WP. I copied the code above and replaced the directories but the page is empty, even the scripts are not loaded. Could you please explain how to use the files without a CMS, just for a single GPX file in a bit more detail?

    Thanks,
    Be

    #21655 Rispondi
    max
    Amministratore del forum

    Hi, this is a working sample, just unzip the folder and everything should work

    [wpdm_file id=4]

    #23525 Rispondi
    Dener Fernandes
    Ospite

    Hi,

    This code non-wordpress was exactly what I was looking for, just unable to display the Heart rate, values ​​comes zeroed, on wordpress is shown, but the plug-in non-wordpress not. What can it be?

    My GPX: http://www.personalon.com.br/activity_398049934.gpx

    On wordpress: http://personalon.com.br/blog/nutricao/teste/

    Could you please help me?

    Att;

    :good:

    #23527 Rispondi
    max
    Amministratore del forum

    You should set the variable

    echo handle_WP_GPX_Maps_Shortcodes( Array (
    “gpx”=> $gpxUrl,
    “width”=> “100%”,
    “mheight”=> “450px”,
    “mtype”=>”HYBRID”,
    “gheight”=> “200px”,
    “showcad”=>false,
    “showhr”=> true,
    “waypoints”=> false,

    #24710 Rispondi
    Paul
    Ospite

    Hi Max!

    Thank you very much! That’s exactly what I need for my website. But since I a couple of comments.

    How do I get a message for updates?

    I use the pages so created as an iFrame into my website. It would be nice if the full screen function would work out of the iframe out. So they will only work within the iframes.

    When activating the scroll-zoom must be “true” to be quoted.

    The text of the numbers of elevations in Altidue graphics are unfortunately obscured. Can this be fixed?

    #24711 Rispondi
    Paul
    Ospite

    Ok, i have find it yourself.
    http://api.highcharts.com/highcharts#xAxis.labels.x
    in the javascript file ->
    #####
    var yaxe = {
    title: { text: null },
    labels: {
    align: ‘left’,
    // START EDIT
    x: 0,
    // END EDIT
    formatter: function() {
    return Highcharts.numberFormat(this.value, l_y.dec,decPoint,thousandsSep) + l_y.suf;
    }
    }
    }
    ######

    Another Question: Is it possible to operate the plugin complete without Google? Or is Google an integral part?

    #28830 Rispondi
    Charlie
    Ospite

    My website is on weebly and would love to us your plug-in but I am not great with code…can you help??

    #75779 Rispondi
    max
    Amministratore del forum

    I just updated the sample with a fiew changes.
    If you have a (few) programming skills you can follow the sample above..

    #80886 Rispondi
    fran6t
    Ospite

    Hello,
    to avoïd warning and for it works standalone i have modified like this :

    Add define for ABSPATH use line 3 of wp-gpx-maps_utils.php
    Add fictif object $post use line 664 script wp-gpx-maps.php

    To work
    Add declaration css leaflet in head
    Add declaration js leadflet in head

    Example of my standalone

    <?php
    
    define("ABSPATH" , "/media/4T2M/tvix/www/gpxtrace/"); // Path complete by "wp-admin/includes/file.php"
    
    $sitePath = "./"; // or realpath('.');
    $uploadDir = $sitePath . "wp-content/uploads"; // Must be writable. The plugin will create the /gpx and /gpx/~cache subfolders
    $pluginDir = $sitePath . "wp-content/plugins/wp-gpx-maps/"; // wordpress plugin path
    
    $uploadUrl = "/wp-content/uploads/gpx/"; // gpx download path
    $gpxUrl = $uploadUrl . "Mountainbike.gpx"; // your gpx file
    
    // Use line 664 file wp-gpx-maps.php 
    $post = (object) [
        'ID' => 1
    ]; 
     
    /* wordpress function wrapper */
    function load_plugin_textdomain(){}
    function is_admin() {return false;}
    function add_action(){}
    function add_shortcode(){}
    function register_activation_hook(){}
    function register_deactivation_hook(){}
    function add_filter(){}
    function get_option(){return "";}
    function wp_upload_dir(){global $uploadDir; return Array ( "basedir" => $uploadDir ); }
    function plugins_url(){global $uploadUrl; return $uploadUrl ;}
    function __($val){return $val;}
     
    include $pluginDir.'wp-gpx-maps.php';
    ?>
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>WP GPX Maps - standalone</title>
    <script src="//code.jquery.com/jquery-1.9.1.min.js"></script>
    
    <script type='text/javascript' src='<?php echo $pluginDir; ?>ThirdParties/Leaflet_1.3.1/leaflet.js?ver=1.3.1'></script>
    <script type='text/javascript' src='<?php echo $pluginDir; ?>ThirdParties/leaflet.fullscreen-1.1.4/Control.FullScreen.js?ver=1.1.4'></script>
    <script type='text/javascript' src='<?php echo $pluginDir; ?>js/Chart.min.js?ver=2.7.2'></script>
    <script type='text/javascript' src='<?php echo $pluginDir; ?>js/WP-GPX-Maps.js?ver=1.6.02'></script>
    <link rel='stylesheet' id='leaflet-css'  href='<?php echo $pluginDir; ?>ThirdParties/Leaflet_1.3.1/leaflet.css?ver=1.3.1' type='text/css' media='all' />
    <link rel='stylesheet' id='leaflet.fullscreen-css'  href='<?php echo $pluginDir; ?>ThirdParties/leaflet.fullscreen-1.1.4/Control.FullScreen.css?ver=1.3.1' type='text/css' media='all' />
    
    <script src="//maps.googleapis.com/maps/api/js?sensor=false&v=3.9" type="text/javascript" ></script>
    <script src="//code.highcharts.com/highcharts.js" type="text/javascript" ></script>
    <script src="<?php echo $pluginDir; ?>js/WP-GPX-Maps.js" type="text/javascript" ></script>
    
    <style type="text/css" media="screen">
    <?php
    
    echo print_WP_GPX_Maps_styles();
    ?>
    </style>
    </head>
    <body>
    <?php
     
    /*
    plugin call with all the possible settings
    more info here: http://wordpress.org/extend/plugins/wp-gpx-maps/faq/
    */
     
    echo handle_WP_GPX_Maps_Shortcodes( Array (
    "gpx"=> $gpxUrl,
    "width"=> "100%",
    "mheight"=> "450px",
    "mtype"=>"HYBRID",
    "gheight"=> "200px",
    "showcad"=>false,
    "showhr"=> false,
    "waypoints"=> false,
    "showspeed"=> true,
    "showgrade"=> true,
    "zoomonscrollwheel"=> false,
    "donotreducegpx"=> false,
    "pointsoffset"=> 10,
    "uom"=>"0",
    "uomspeed"=>"0",
    "mlinecolor"=>"#3366cc",
    "glinecolor"=>"#3366cc",
    "glinecolorspeed"=>"#ff0000",
    "glinecolorhr"=>"#ff77bd",
    "glinecolorcad"=>"#beecff",
    "glinecolorgrade"=>"#beecff",
    "chartfrom1"=>"",
    "chartto1"=>"",
    "chartfrom2"=>"",
    "chartto2"=> "",
    "starticon"=> "",
    "endicon"=> "",
    "currenticon"=> "",
    "waypointicon"=> "",
    "nggalleries"=> "",
    "ngimages"=>"",
    "download"=> "",
    "dtoffset"=> 0,
    "skipcache"=> "",
    "summary"=> "",
    "summarytotlen"=> true,
    "summarymaxele"=> true,
    "summaryminele"=> true,
    "summaryeleup"=>true,
    "summaryeledown"=> true,
    "summaryavgspeed"=> true,
    "summarytotaltime"=>true,
    ) );
     
    ?>
     
    </body>
    </html>
    
    #95828 Rispondi
    lestertw16
    Ospite

    Hermaphrodite Shemale Porn Galleries
    http://datingnaked.telrock.org/?veronica

    shimale movie shemalesex sex shemen younger tranys transexuals movies

    #96362 Rispondi
    jayza16
    Ospite

    Free tranny sex, free tranny tube, tranny movies, tranny videos, tranny xxx
    http://dailydatingtest.telrock.net/?elisabeth

    semale freeshemale vids shemal shemals amateur transexual pictures

    #96874 Rispondi
    phyllisir18
    Ospite

    Twink boyfriends, webcam, hairy gay bears
    http://safethedate.telrock.net/?phoebe

    gratis sex cam 4 gay sg boys sex stats lesbiene filme gay chat swiss

    #99983 Rispondi
    oraat16
    Ospite

    My new hot project|enjoy new website
    http://ocracoke.danexxx.com/?reagan
    mrs emma starr free porn caged women porn moaing girl porn porn hub red fake celebritie porn

Stai visualizzando 14 post - dal 1 a 14 (di 14 totali)
Rispondi a: Risposta #28830 in [How-To] Use wp-gpx-maps on a non-wordpress website

You can use BBCodes to format your content.
Your account can't use Advanced BBCodes, they will be stripped before saving.

Le tue informazioni:




Non è possibile lasciare nuovi commenti.