1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
<?php
/**
* @version $Revision: 1.8 $
* @package liberty
* @subpackage plugins_data
*/
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See copyright.txt for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
// |
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
// $Id: data.mqdirections.php,v 1.8 2007/06/09 18:09:39 squareing Exp $
/**
* definitions
*/
define( 'PLUGIN_GUID_DATAMQDIR', 'datamqdir' );
global $gLibertySystem;
$pluginParams = array (
'tag' => 'MQDIR',
'auto_activate' => FALSE,
'requires_pair' => FALSE,
'load_function' => 'data_mqdir',
'title' => 'MapQuest Directions',
'help_page' => 'DataPluginMapQuestDirections',
'description' => tra("Creates an Icon link to MapQuest with a form to get Directions from MapQuest based on a Destination Address."),
'help_function' => 'data_mqdir_help',
'syntax' => "{MQDIR icon= myicon= text= address= city= state= zip= country= }",
'path' => LIBERTY_PKG_PATH.'plugins/data.mqdirections.php',
'security' => 'registered',
'plugin_type' => DATA_PLUGIN
);
$gLibertySystem->registerPlugin( PLUGIN_GUID_DATAMQDIR , $pluginParams );
$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAMQDIR );
// Help Function
function data_mqdir_help() {
$help =
'<table class="data help">'
.'<tr>'
.'<th>' . tra( "Key" ) . '</th>'
.'<th>' . tra( "Type" ) . '</th>'
.'<th>' . tra( "Comments" ) . '</th>'
.'</tr>'
.'<tr class="odd">'
.'<td>icon</td>'
.'<td>' . tra( "key-word") . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "Creates an Icon Link to MapQuests primary URL. The size of the Icon can be:")
.' <strong>sm</strong> ' . tra("= Small,")
.' <strong>med</strong> ' . tra("= Medium,")
.' <strong>lg</strong> ' . tra("= Large or")
. tra("<br />The Default = ") . ' <strong>sm</strong> ' . tra("The Small MapQuest Icon is displayed.")
.'</td>'
.'</tr>'
.'<tr class="even">'
.'<td>address</td>'
.'<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "The Street Address")
. tra("<br />The Default = ") . '<strong>NONE</strong></td>'
.'</tr>'
.'<tr class="odd">'
.'<td>city</td>'
.'<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "The City")
. tra("<br />The Default = ") . '<strong>NONE</strong></td>'
.'</tr>'
.'<tr class="even">'
.'<td>state</td>'
.'<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "The State or Province")
. tra("<br />The Default = ") . '<strong>NONE</strong></td>'
.'</tr>'
.'<tr class="odd">'
.'<td>zip</td>'
.'<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "The Zip or Postal Code")
. tra("<br />The Default = ") . '<strong>NONE</strong></td>'
.'</tr>'
.'<tr class="even">'
.'<td>country</td>'
.'<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
.'<td>' . tra( "The Country (Uses 2-digit ISO Codes)")
. tra("<br />The Default = ") . '<strong>US</strong>'
. tra("<br /><strong>Note:</strong> 2-Digit ISO Country Codes are available from ")
. "<a href=\"http://www.bcpl.net/~j1m5path/isocodes-table.html\">" . tra("ISO Country Codes").'</a></td>'
.'</tr>'
.'</table>'
. tra("Example: ") . "{MQDIR icon=sm address='1730 Blake St' city=Denver state=CO zip=80202 }";
return $help;
}
// Load Function
function data_mqdir( $data, $params ) {
extract ($params, EXTR_SKIP);
$a2a = isset($address) ? $address : ' ';
$a2c = isset($city) ? $city : ' ';
$a2s = isset($state) ? $state : ' ';
$a2z = isset($zip) ? $zip : ' ';
$a2y = isset($country) ? $country : 'US';
$icon = isset($icon) ? $icon : "SM"; // Test for the MapQuest Icon
switch(strtoupper($icon)) {
case 'SM':
$icn = 'ws_wt_sm';
break;
case 'MED':
$icn = 'ws_wt_md';
break;
case 'LG':
$icn = 'ws_wt_lg';
break;
case 'NONE':
$ret = ' ';
break;
}
$ret =
'<form action="http://www.mapquest.com/directions/main.adp" method="get">'
.'<div align="center">'
.'<input type="hidden" name="go" value="1+">'
.'<input type="hidden" name="2a" value="' . $a2a . '">'
.'<input type="hidden" name="2c" value="' . $a2c . '">'
.'<input type="hidden" name="2s" value="' . $a2s . '">'
.'<input type="hidden" name="2z" value="' . $a2z . '">'
.'<input type="hidden" name="2y" value="' . $a2y . '">'
.'<br />'
.'<table border="0" cellpadding="0" cellspacing="0" style="font: 11px Arial,Helvetica;">'
.'<tr><td colspan="2" style="font-weight: bold;">'
.'<div align="center">'
.'<a href="http://www.mapquest.com/"><img border="0" src="http://cdn.mapquest.com/mqstyleguide/' . $icn . '" alt="MapQuest"></a>'
.'</div>'
.'</td></tr>'
.'<tr><td colspan="2" style="font-weight: bold;">FROM:</td></tr>'
.'<tr><td colspan="2">Address or Intersection: </td></tr>'
.'<tr><td colspan="2"><input type="text" name="1a" size="22" maxlength="30" value=""></td></tr>'
.'<tr> <td colspan="2">City: </td></tr>'
.'<tr> <td colspan="2"><input type="text" name="1c" size="22" maxlength="30" value=""></td></tr>'
.'<tr><td>State:</td>'
.'<td> ZIP Code:</td></tr>'
.'<tr><td><input type="text" name="1s" size="4" maxlength="2" value=""></td><td>'
.'<input type="text" name="1z" size="8" maxlength="10" value=""></td></tr>'
.'<tr><td colspan="2">Country:</td></tr>'
.'<tr><td colspan="2"><select name="1y"><option value="CA">Canada</option><option value="US" selected>United States</option></select></td></tr>'
.'<tr> <td colspan="2" style="text-align: center; padding-top: 10px;"><input type="submit" name="dir" value="Get Directions" border="0"></td></tr>'
.'<input type="hidden" name="CID" value="lfddwid">'
.'</table>'
.'</div>'
.'</form>';
return $ret;
}
?>
|