| Server IP : 188.114.96.2 / Your IP : 104.23.243.201 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/nicolasj/www/b2b.ecoledelangues.be/wp-content/plugins/wp-google-maps/includes/ |
Upload File : |
<?php
namespace WPGMZA;
// header('Content-type: text/plain');
require_once(__DIR__ . '/class.marker.php');
// Create a new marker
$marker = Marker::createInstance();
// Trash it
$marker->trash();
// Create a new marker with data
$marker = Marker::createInstance(array(
'map_id' => 1,
'lat' => 52,
'lng' => -2,
'title' => 'Bristol',
'link' => 'https://visitbristol.co.uk/'
));
// Access a field on the marker
$marker->address = "10 Weston Lodge, Weston-super-Mare, England";
// Alter a field on the marker
$marker->description = 'This is an example description';
// Add some variables to other_data
$marker->example = 'This will be automagically stored on other_data';
// Unset some data on the marker
unset($marker->example);
// Set multiple fields (to be economical with DB calls)
$marker->set(array(
'lat' => 51.4545,
'lng' => -2.5879,
'address' => 'Bristol, UK',
'some_arbitrary_data' => 'yes' // This will be stored in other_data
));
// Store some object data on the marker
$marker->example_object_data = (object)array(
'test' => 1,
'arr' => array('apple', 'orange', 'banana')
);
// Iterate over the markers fields and do something with them
foreach($marker as $key => $value)
echo "$key\t\t= " . print_r($value, true) . PHP_EOL;
// Save POST data to marker, without handling it!!
if(isset($_POST['action']) && $_POST['action'] == 'wpgmza_save_marker')
{
$marker_id = $_POST['marker_id'];
unset($_POST['marker_id']);
unset($_POST['action']);
$marker->set($_POST);
}
// Store the marker as JSON
$json = json_encode($marker);
echo "JSON string: " . $json . PHP_EOL;
// Get the new markers ID
$id = $marker->id;
echo "Marker ID: " . $id . PHP_EOL;
// Forget the marker
unset($marker);
// Load an existing marker
$marker = Marker::createInstance($id);
// Get rid of the marker now we're done with it
$marker->trash();
// Now lets do some really cool stuff
$marker = Marker::createInstance();
// The Marker object loads the markers custom fields through a CustomMarkerFields object
$marker->custom_fields->my_custom_field = 'How cool is this';
var_dump($marker->custom_fields->test);
exit;