BMLT Satellite Driver
/home/runner/work/bmlt-satellite-driver/bmlt-satellite-driver/bmlt_satellite_controller.class.php
1 <?php
2 
3 /****************************************************************************************/
4 /**
5 \brief Provides low-level communication to the BMLT Root Server.
6 
7 \version 1.1.1
8 
9 This file is part of the Basic Meeting List Toolbox (BMLT).
10 
11 Find out more at: https://bmlt.app
12 
13 BMLT is free software: you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17 
18 BMLT is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22 
23 You should have received a copy of the GNU General Public License
24 along with this code. If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 /****************************************************************************************//**
28  * \brief This is the main class for the Satellite Controller. It establishes a liaison *
29  * with the root server. *
30  * *
31  * This class will perform the REST communication with the server, and will also aid in *
32  * interpreting and organizing the communications. It does not assemble any HTML, *
33  * JavaScript or CSS. That will be left to View Layer implementations that use this class. *
34  ********************************************************************************************/
35 // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
36 // phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
38 // phpcs:enable PSR1.Classes.ClassDeclaration.MissingNamespace
39 // phpcs:enable Squiz.Classes.ValidClassName.NotCamelCaps
40 {
41  /****************************************************************************************
42  * STATIC DATA MEMBERS *
43  ****************************************************************************************/
44  /// This is a static data member, because the list will apply to all instances. Slot 0 is the default protocol.
45  private static $m_supported_protocols = array ( ///< An array of strings. The supported protocols
46  'http', ///< Standard HTTP (Default protocol)
47  'https' ///< SSL
48  );
49 
50  /****************************************************************************************
51  * DYNAMIC DATA MEMBERS *
52  ****************************************************************************************/
53  private $m_root_uri_string = null; ///< This is a string, containing the URI to the root server.
54  private $m_error_message = null; ///< This is a string that will contain any error messages.
55 
56  /************************************************************************************//**
57  * The way that the outgoing associative array will work, is that it will be filled *
58  * with the keys that are available to the implementor to be used in a query to the *
59  * root server. Some of these keys will have arrays of still more keys, and some of *
60  * these "contained arrays" of values will be filled at runtime, after some *
61  * transactions have been executed with the server. *
62  ****************************************************************************************/
63  private $m_outgoing_parameters = null; /**< An associative array of mixed values.
64 The array keys will be the parameter keys
65 for outgoing transaction stimuli.
66 This array is preset with keys for the available parameters.
67  */
68  private $m_server_version = null; ///< The server version. Null if the server has not been queried.
69  private $m_current_transaction = null; ///< This will hold an array of transaction parameter values for an outgoing transaction.
70 
71  /****************************************************************************************
72  * CONSTRUCTOR *
73  ****************************************************************************************/
74 
75  /************************************************************************************//**
76  * \brief Constructor -Set the value of the Root URI. *
77  * If a URI is passed in, then the object establishes and tests a connection, and *
78  * loads up the standard outgoing parameters. *
79  * This object requires that the server be of version 1.8.6 or greater. *
80  ****************************************************************************************/
81  public function __construct($in_root_uri_string = null) ///< The URI to the root server, can be null
82  {
83  if ($in_root_uri_string) {
84  // Don't need to flush the params, as we'll be doing that next.
85  $this->set_m_root_uri($in_root_uri_string, true);
86  }
87 
88  // Initialize the parameters.
89  $this->flush_parameters();
90 
91  // OK, now we talk to the server, and fill up on the various server-specific things.
92  if ($in_root_uri_string) {
93  // The first thing we do, is get the server version. We must have version 1.8.6 or greater.
94  $version = $this->get_server_version();
95  if (!$this->get_m_error_message()) {
96  $version_int = intval(str_replace('.', '', $version));
97  if ($version_int > 185) {
98  if (!extension_loaded('curl')) { // Must have cURL. This puppy won't work without cURL.
99  $this->set_m_error_message('__construct: The cURL extension is not available! This code will not work on this server!');
100  } else {
102  }
103  } else {
104  $this->set_m_error_message('__construct: The root server at (' . $in_root_uri_string . ') is too old (it is version ' . $version . ')! It needs to be at least Version 1.8.6!');
105  }
106  }
107  }
108  }
109 
110  /****************************************************************************************
111  * ACCESSOR FUNCTIONS *
112  ****************************************************************************************/
113 
114  /************************************************************************************//**
115  * \brief Accessor -Set the value of the Root URI. *
116  * *
117  * NOTE: If the server URI changes, the parameters are flushed. *
118  ****************************************************************************************/
119  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
120  public function set_m_root_uri(
121  $in_root_uri_string, // A string. The URI to set to the data member. This is set verbatim. Cleaning is performed at recall time.
122  $in_skip_flush = false ///< Optional. If true, the parameters won't be flushed, even if they need to be.
123  ) {
124  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
125  // If we are selecting a new server, or changing servers, we flush all stored parameters.
126  if (!$in_skip_flush && strcmp($in_root_uri_string, $this->m_root_uri_string ?? '')) {
127  $this->flush_parameters();
128  }
129 
130  $this->m_root_uri_string = $in_root_uri_string;
131  }
132 
133  /************************************************************************************//**
134  * \brief Accessor -Return the value of the Root URI. Perform "cleaning" if necessary. *
135  * *
136  * \returns A string. The root URI, with the protocol preamble. If none is given, *
137  * "http" is used. Also, there is no trailing slash. *
138  ****************************************************************************************/
139  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
140  public function get_m_root_uri()
141  {
142  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
143  $ret_string = $this->m_root_uri_string;
144  $protocols = self::get_m_supported_protocols();
145  $protocol = $protocols[0]; // Element zero has the default protocol.
146 
147  // We check for a supported protocol, here. It must be HTTP or HTTPS.
148  $matches = array();
149  $uri = ''; // This will be the base URI to the main_server directory.
150  // See if we have a protocol preamble. Separate the URI into components.
151  if (preg_match('|^(.*?):\/\/(.*?)/?$|', $ret_string, $matches)) {
152  $protocol = strtolower($matches[1]);
153  // See if we are a supported protocol.
154  if (!in_array($protocol, $protocols)) {
155  $protocol = $protocols[0]; // The default protocol is in element zero.
156  }
157 
158  $uri = $matches[2]; // This strips off any trailing slash.
159  } else {
160  // Strip off any trailing slash.
161  preg_match('|^(.*?)\/?$|', $ret_string, $matches);
162  $uri = $matches[1];
163  }
164 
165  // At this point, we have a protocol, and a URI that has had its trailing slash removed.
166  // Reassemble them into a "cleaned" return string.
167 
168  $ret_string = $protocol . '://' . $uri;
169 
170  return $ret_string;
171  }
172 
173  /************************************************************************************//**
174  * \brief Accessor -Set the server version. *
175  ****************************************************************************************/
176  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
177  private function set_m_server_version($in_version) ///< A string. The version information.
178  {
179  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
180  $this->m_server_version = $in_version;
181  }
182 
183  /************************************************************************************//**
184  * \brief Accessor -Return the value of the server version (if any). *
185  * *
186  * \returns A string. *
187  ****************************************************************************************/
188  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
189  private function get_m_server_version()
190  {
191  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
192  return $this->m_server_version;
193  }
194 
195  /************************************************************************************//**
196  * \brief Accessor -Set the class error message. *
197  ****************************************************************************************/
198  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
199  private function set_m_error_message($in_error_message) ///< A string. The error message.
200  {
201  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
202  $this->m_error_message = $in_error_message;
203  }
204 
205  /************************************************************************************//**
206  * \brief Accessor -Return the value of the class error message (if any). *
207  * *
208  * \returns A string. *
209  ****************************************************************************************/
210  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
211  public function get_m_error_message()
212  {
213  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
214  return $this->m_error_message;
215  }
216 
217  /************************************************************************************//**
218  * \brief Accessor -Set the class transaction "bucket" *
219  ****************************************************************************************/
220  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
221  private function set_m_current_transaction($in_current_transaction) ///< An array of mixed.
222  {
223  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
224  $this->m_current_transaction = $in_current_transaction;
225  }
226 
227  /************************************************************************************//**
228  * \brief Accessor -Return a reference to the class transaction "bucket." *
229  * *
230  * \returns A reference to an array of mixed. *
231  ****************************************************************************************/
232  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
233  public function &get_m_current_transaction()
234  {
235  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
236  return $this->m_current_transaction;
237  }
238 
239  /************************************************************************************//**
240  * \brief Accessor -Return the transaction stimulus array. *
241  * *
242  * \returns A reference to an array of mixed. *
243  ****************************************************************************************/
244  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
245  public function &get_m_outgoing_parameters()
246  {
247  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
248  return $this->m_outgoing_parameters;
249  }
250 
251  /****************************************************************************************
252  * CLASS FUNCTIONS *
253  ****************************************************************************************/
254  /************************************************************************************//**
255  * \brief Test the stored URI to see if it points to a valid root server, and return *
256  * the server version. *
257  * *
258  * This will cache the response in the incoming parameter ('m_server_version'), and *
259  * will return the cached value, if possible. *
260  * *
261  * This will set or clear the internal $m_error_message data member. *
262  * *
263  * \returns A string, containing the server version. Null if the test fails. *
264  ****************************************************************************************/
265  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
266  public function get_server_version($in_force_refresh = false) ///< If this is true, then the server will be queried, even if there is a cache.
267  {
268  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
269  $ret = null;
270 
271  $error_message = null; // We will collect any error messages.
272 
273  // We start by clearing any internal error message.
274  $this->set_m_error_message($error_message);
275 
276  if ($in_force_refresh || !$this->get_m_server_version()) {
277  $uri = $this->get_m_root_uri(); // Get the cleaned URI.
278 
279  $uri .= '/client_interface/json/?switcher=GetServerInfo'; // We will load the JSON.
280 
281  // Get the JSON data from the remote server. We will use GET.
282  $data = self::call_curl($uri, false, $error_message);
283 
284  // Save any internal error message from the transaction.
285  $this->set_m_error_message($error_message);
286 
287  // If we get a valid response, we then parse the JSON.
288  if (!$this->get_m_error_message() && $data) {
289  $info = json_decode($data, true);
290  $ret = $info[0]["version"];
291  $this->set_m_server_version($ret);
292  }
293 
294  if (!$ret && !$this->get_m_error_message()) {
295  $this->set_m_error_message('get_server_version: Invalid URI (' . $uri . ')');
296  }
297  } else {
298  $ret = $this->get_m_server_version();
299  }
300 
301  return $ret;
302  }
303 
304  /************************************************************************************//**
305  * \brief Return the server supported languages. *
306  * *
307  * This will cache the response in the outgoing parameters ('langs'), and will return *
308  * the cached value, if possible. *
309  * *
310  * This will set or clear the internal $m_error_message data member. *
311  * *
312  * \returns An associative array, containing the server languages (the key will *
313  * indicate the language key, and the value will be an array with the readable *
314  * name of the language, and a "default" if this is the server's "native" language). *
315  ****************************************************************************************/
316  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
317  public function get_server_langs($in_force_refresh = false) ///< If this is true, then the server will be queried, even if there is a cache.
318  {
319  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
320  $ret = null;
321 
322  $error_message = null; // We will collect any error messages.
323 
324  // We start by clearing any internal error message.
325  $this->set_m_error_message($error_message);
326 
327  if ($in_force_refresh || !is_array($this->get_m_outgoing_parameter('langs')) || !count($this->get_m_outgoing_parameter('langs'))) {
328  $uri = $this->get_m_root_uri(); // Get the cleaned URI.
329 
330  $uri .= '/client_interface/json/?switcher=GetServerInfo'; // We will load the JSON.
331 
332  // Get the JSON data from the remote server. We will use GET.
333  $data = self::call_curl($uri, false, $error_message);
334 
335  // Save any internal error message from the transaction.
336  $this->set_m_error_message($error_message);
337 
338  // If we get a valid response, we then parse the JSON.
339  if (!$this->get_m_error_message() && $data) {
340  $ret = array();
341 
342  $data = json_decode($data, true);
343  $langs = explode(",", $data[0]["langs"]);
344  $default_lang = $data[0]["nativeLang"];
345  foreach ($langs as $lang) {
346  $ret[$lang]['name'] = $lang;
347  $ret[$lang]['default'] = $lang === $default_lang ? true : false;
348  }
349  $this->set_m_outgoing_parameter('langs', $ret);
350  }
351 
352  if (!$ret && !$this->get_m_error_message()) {
353  $this->set_m_error_message('get_server_langs: Invalid URI (' . $uri . ')');
354  }
355  } else {
356  $ret = $this->get_m_outgoing_parameter('langs');
357  }
358 
359  return $ret;
360  }
361 
362  /************************************************************************************//**
363  * \brief Return meeting changes between two dates. *
364  * *
365  * This requires that the server be version 1.8.13 or greater. *
366  * This queries the server for meeting change records between (and including) the two *
367  * dates given. The dates are optional. However, not supplying them means that the *
368  * entire server change record is returned, which is quite a mouthful. You can specify *
369  * just one of the parameters (all the changes after a date to now, or all of the *
370  * changes since the server started until a certain date). *
371  * *
372  * There is no caching of this call. It is always real-time. *
373  * *
374  * The dates are given as PHP UNIX times (integer epoch times). *
375  * *
376  * This will set or clear the internal $m_error_message data member. *
377  * *
378  * \returns An indexed array containing the change records as associative arrays. *
379  ****************************************************************************************/
380  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
381  public function get_meeting_changes(
382  $in_start_date = null, ///< Optional. If given (a PHP time() format UNIX Epoch time), the changes will be loaded from midnight (00:00:00) of the date of the time.
383  $in_end_date = null, ///< Optional. If given (a PHP time() format UNIX Epoch time), the changes will be loaded until midnight (23:59:59) of the date of the time.
384  $in_meeting_id = null, ///< If supplied, an ID for a particular meeting. Only changes for that meeting will be returned.
385  $in_service_body_id = null ///< If supplied, an ID for a particular Service body. Only changes for meetings within that Service body will be returned.
386  ) {
387  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
388  $ret = null;
389 
390  $error_message = null; // We will collect any error messages.
391 
392  // We start by clearing any internal error message.
393  $this->set_m_error_message($error_message);
394 
395  $uri = $this->get_m_root_uri(); // Get the cleaned URI.
396 
397  $uri .= '/client_interface/json/?switcher=GetChanges'; // We will load the JSON data.
398 
399  if (intval($in_start_date)) {
400  $uri .= '&start_date=' . date('Y-m-d', intval($in_start_date));
401  }
402 
403  if (intval($in_end_date)) {
404  $uri .= '&end_date=' . date('Y-m-d', intval($in_end_date));
405  }
406 
407  if (intval($in_meeting_id)) {
408  $uri .= '&meeting_id=' . intval($in_meeting_id);
409  }
410 
411  if (intval($in_service_body_id)) {
412  $uri .= '&service_body_id=' . intval($in_service_body_id);
413  }
414 
415  // Get the JSON data from the remote server. We will use GET.
416  $data = self::call_curl($uri, false, $error_message);
417 
418  // Save any internal error message from the transaction.
419  $this->set_m_error_message($error_message);
420 
421  // If we get a valid response, we then parse the JSON.
422  if (!$this->get_m_error_message() && $data) {
423  $info_file = new DOMDocument();
424  if ($data && $data !== '{}' && $data !== '[]') {
425  $ret = array();
426  $data = json_decode($data, true);
427  foreach ($data as $key => $value) {
428  $ret[$key] = $value;
429  $ret[$key]["json_data"] = json_encode($ret[$key]["json_data"]);
430  }
431  }
432  } elseif (!$this->get_m_error_message()) {
433  $this->set_m_error_message('get_meeting_changes: Invalid URI (' . $uri . ')');
434  }
435 
436  return $ret;
437  }
438 
439  /************************************************************************************//**
440  * \brief Return the server supported formats. *
441  * *
442  * This will cache the response in the outgoing parameters ('formats'), and will *
443  * return the cached value, if possible. *
444  * *
445  * This will set or clear the internal $m_error_message data member. *
446  * *
447  * \returns An associative array containing the formats as arrays. The array index is *
448  * that format's shared ID, for quick lookup. *
449  ****************************************************************************************/
450  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
451  public function get_server_formats($in_force_refresh = false) ///< If this is true, then the server will be queried, even if there is a cache.
452  {
453  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
454  $ret = null;
455 
456  $error_message = null; // We will collect any error messages.
457 
458  // We start by clearing any internal error message.
459  $this->set_m_error_message($error_message);
460 
461  if ($in_force_refresh || !is_array($this->get_m_outgoing_parameter('formats')) || !count($this->get_m_outgoing_parameter('formats'))) {
462  $uri = $this->get_m_root_uri(); // Get the cleaned URI.
463 
464  $uri .= '/client_interface/json/?switcher=GetFormats'; // We will load the JSON.
465 
466  // Get the JSON data from the remote server. We will use GET.
467  $data = self::call_curl($uri, false, $error_message);
468 
469  // Save any internal error message from the transaction.
470  $this->set_m_error_message($error_message);
471 
472  // If we get a valid response, we then parse the JSON.
473  if (!$this->get_m_error_message() && $data) {
474  $ret = array();
475  $data = json_decode($data, true);
476  foreach ($data as $format) {
477  $ret[$format['id']] = $format;
478  }
479  } elseif (!$this->get_m_error_message()) {
480  $this->set_m_error_message('get_server_formats: Invalid URI (' . $uri . ')');
481  }
482  } else {
483  $ret = $this->get_m_outgoing_parameter('formats');
484  }
485 
486  return $ret;
487  }
488 
489  /************************************************************************************//**
490  * \brief Return the server's Service bodies, in hierarchical fashion. *
491  * *
492  * This will cache the response in the outgoing parameters ('services'), and will *
493  * return the cached value, if possible. *
494  * *
495  * This will set or clear the internal $m_error_message data member. *
496  * *
497  * \returns An associative array, containing the server Service bodies
498  ****************************************************************************************/
499  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
500  public function get_server_service_bodies($in_force_refresh = false) ///< If this is true, then the server will be queried, even if there is a cache.
501  {
502  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
503  $ret = null;
504 
505  $error_message = null; // We will collect any error messages.
506 
507  // We start by clearing any internal error message.
508  $this->set_m_error_message($error_message);
509 
510  if ($in_force_refresh || !is_array($this->get_m_outgoing_parameter('services')) || !count($this->get_m_outgoing_parameter('services'))) {
511  $uri = $this->get_m_root_uri(); // Get the cleaned URI.
512 
513  $uri .= '/client_interface/json/?switcher=GetServiceBodies'; // We will load the JSON.
514 
515  // Get the JSON data from the remote server. We will use GET.
516  $data = self::call_curl($uri, false, $error_message);
517 
518  // Save any internal error message from the transaction.
519  $this->set_m_error_message($error_message);
520 
521  // If we get a valid response, we then parse the JSON.
522  if (!$this->get_m_error_message() && $data) {
523  $ret = array();
524  $data = json_decode($data, true);
525  foreach ($data as $serviceBody) {
526  $ret[$serviceBody['id']] = $serviceBody;
527  }
528  } elseif (!$this->get_m_error_message()) {
529  $this->set_m_error_message('get_server_service_bodies: Invalid URI (' . $uri . ')');
530  }
531  } else {
532  $ret = $this->get_m_outgoing_parameter('services');
533  }
534 
535  return $ret;
536  }
537 
538  /************************************************************************************//**
539  * \brief Return a list of the supported meeting_key values.. *
540  * *
541  * Each root server can define its own meeting data item keys, so we need to fetch the *
542  * ones defined by this server. We do this by parsing the dynamically-generated *
543  * schema document from the server. *
544  * *
545  * This will cache the response in the outgoing parameters ('meeting_keys'), and will *
546  * return the cached value, if possible. *
547  * *
548  * This will set or clear the internal $m_error_message data member. *
549  * *
550  * \returns An array of strings, containing the server meeting_key values. *
551  ****************************************************************************************/
552  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
553  public function get_server_meeting_keys($in_force_refresh = false) ///< If this is true, then the server will be queried, even if there is a cache.
554  {
555  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
556  $ret = null;
557 
558  $error_message = null; // We will collect any error messages.
559 
560  // We start by clearing any internal error message.
561  $this->set_m_error_message($error_message);
562 
563  if ($in_force_refresh || !is_array($this->get_m_outgoing_parameter('meeting_key')) || !count($this->get_m_outgoing_parameter('meeting_key'))) {
564  $uri = $this->get_m_root_uri(); // Get the cleaned URI.
565 
566  $uri .= '/client_interface/json/?switcher=GetFieldKeys'; // We will load the JSON.
567 
568  // Get the JSON data from the remote server. We will use GET.
569  $data = self::call_curl($uri, false, $error_message);
570  // Save any internal error message from the transaction.
571  $this->set_m_error_message($error_message);
572 
573  // If we get a valid response, we then parse the JSON.
574  if (!$this->get_m_error_message() && $data) {
575  $data = json_decode($data, true);
576  foreach ($data as $field_key) {
577  $ret[] = $field_key["key"];
578  }
579  } elseif (!$this->get_m_error_message()) {
580  $this->set_m_error_message('get_server_meeting_keys: Invalid URI (' . $uri . ')');
581  }
582  } else {
583  $ret = $this->get_m_outgoing_parameter('meeting_key');
584  }
585 
586  return $ret;
587  }
588 
589  /************************************************************************************//**
590  * \brief See if a given parameter key is valid for an outgoing parameter. *
591  * *
592  * This will set or clear the error message. *
593  * *
594  * \returns An array, or null. If an array, it will be an array of possible values. *
595  * Null is not an error. It simply means that this transaction key does not have a set *
596  * of preset values. *
597  ****************************************************************************************/
598  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
599  public function get_transaction_key_values($in_parameter_key) ///< A string. The key for this parameter..
600  {
601  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
602  $ret = null;
603 
604  $this->set_m_error_message(null); // Clear the error message.
605 
606  if ($this->is_legal_transaction_key($in_parameter_key)) {
607  // We start by getting a reference to the outgoing parameters array.
608  $outgoing_parameters =& $this->get_m_outgoing_parameters();
609 
610  // We only respond with keys if the parameter value is a non-empty array.
611  if (is_array($outgoing_parameters[$in_parameter_key]) && count($outgoing_parameters[$in_parameter_key])) {
612  $ret = $outgoing_parameters[$in_parameter_key];
613  }
614  } else {
615  $this->set_m_error_message('get_transaction_key_values: Invalid Parameter Key: "' . $in_parameter_key . '"');
616  }
617 
618  return $ret;
619  }
620 
621  /************************************************************************************//**
622  * \brief See if a given parameter key is valid for an outgoing parameter. *
623  * *
624  * \returns A Boolean. True if it is legal, false, otherwise. *
625  ****************************************************************************************/
626  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
627  public function is_legal_transaction_key(
628  $in_parameter_key, ///< A string. The key for this parameter.
629  $in_sub_key = null ///< Optional. If this is a meeting_key value, see if it is legal. Ignored, otherwise.
630  ) {
631  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
632  // We start by getting a reference to the outgoing parameters array.
633  $legal_entities =& $this->get_m_outgoing_parameters();
634 
635  $ret = array_key_exists($in_parameter_key, $legal_entities);
636 
637  if (($in_parameter_key == 'meeting_key') && isset($in_sub_key)) {
638  $ret = $ret && array_key_exists($in_sub_key, $legal_entities[$in_parameter_key]);
639  }
640 
641  return $ret;
642  }
643 
644  /************************************************************************************//**
645  * \brief Add a transaction parameter to a transaction being built. *
646  * *
647  * This will set or clear the error message. *
648  * *
649  * \returns A Boolean. True if it is OK, false, otherwise. *
650  ****************************************************************************************/
651  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
653  $in_parameter_key, ///< A string. The key for this parameter. If there is one already set, this will overwrite that.
654  $in_parameter_value = null ///< Mixed. It can be any value. If an array, then the value will be presented as multiple values.
655  ) {
656  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
657  $ret = false;
658 
659  $this->set_m_error_message(null); // Clear the error message.
660 
661  if ($this->is_legal_transaction_key($in_parameter_key, $in_parameter_value)) {
662  // We start by getting a reference to our transaction array.
663  $transaction_array =& $this->get_m_current_transaction();
664 
665  $transaction_array[$in_parameter_key] = $in_parameter_value;
666  $ret = true;
667  } else {
668  $this->set_m_error_message('set_current_transaction_parameter: Invalid Parameter Key: "' . $in_parameter_key . '"');
669  }
670 
671  return $ret;
672  }
673 
674  /************************************************************************************//**
675  * \brief Clear the Error Message. *
676  ****************************************************************************************/
677  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
678  public function clear_m_error_message()
679  {
680  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
681  $this->m_error_message = null;
682  }
683 
684  /************************************************************************************//**
685  * \brief Return a value from the transaction stimuli array. *
686  * *
687  * \returns A reference to a mixed. This is the value in the array. *
688  ****************************************************************************************/
689  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
690  public function &get_m_outgoing_parameter(
691  $in_parameter_key_string, ///< A string. The parameter key
692  $in_parameter_secondary_key_string = null ///< If the parameter has an embedded array, a key for that (optional)
693  ) {
694  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
695  $ret = null;
696 
697  if (!isset($this->m_outgoing_parameters[$in_parameter_key_string])) {
698  $this->set_m_error_message('get_m_outgoing_parameter: Invalid Key: "' . $in_parameter_key_string . '"');
699  } else {
700  if (isset($in_parameter_secondary_key_string)) {
701  if (!isset($this->m_outgoing_parameters[$in_parameter_key_string][$in_parameter_secondary_key_string])) {
702  $this->set_m_error_message('get_m_outgoing_parameter: Invalid Secondary Key: "' . $in_parameter_secondary_key_string . '"');
703  } else {
704  $ret =& $this->m_outgoing_parameters[$in_parameter_key_string][$in_parameter_secondary_key_string];
705  }
706  } else {
707  $ret =& $this->m_outgoing_parameters[$in_parameter_key_string];
708  }
709  }
710 
711  return $ret;
712  }
713 
714  /************************************************************************************//**
715  * \brief Set a parameter value to the transaction stimulus array. *
716  * *
717  * The outgoing array is "pre-keyed" with the possible parameters. You cannot change *
718  * the keys or access the values by reference. *
719  * *
720  * This will set or clear the internal $m_error_message data member. *
721  ****************************************************************************************/
722  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
723  public function set_m_outgoing_parameter(
724  $in_parameter_key_string, ///< A string. The parameter key
725  $in_parameter_value_mixed ///< A mixed value
726  ) {
727  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
728  // We start by clearing any internal error message.
729  $this->set_m_error_message(null);
730 
731  if (isset($this->m_outgoing_parameters[$in_parameter_key_string])) { // Null is not allowed.
732  if ($in_parameter_value_mixed === null) {
733  $in_parameter_value_mixed = '';
734  }
735  $this->m_outgoing_parameters[$in_parameter_key_string] = $in_parameter_value_mixed;
736  } else {
737  $this->set_m_error_message('set_m_outgoing_parameter: Invalid Key: "' . $in_parameter_key_string . '"');
738  }
739  }
740 
741  /************************************************************************************//**
742  * \brief Sets the outgoing parameter array to its default values. *
743  ****************************************************************************************/
744  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
745  private function set_default_outgoing()
746  {
747  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
748  $this->m_outgoing_parameters = array (
749  /// Weekdays the meeting gathers.
750  'weekdays' => array (),
751 
752  /// Meeting start time values
753  'StartsAfterH' => 0,
754  'StartsAfterM' => 0,
755  'StartsBeforeH' => 0,
756  'StartsBeforeM' => 0,
757 
758  /// Meeting duration values
759  'MinDurationH' => 0,
760  'MinDurationM' => 0,
761  'MaxDurationH' => 0,
762  'MaxDurationM' => 0,
763 
764  /// Search string values
765  'SearchString' => '',
766  'SearchStringAll' => false,
767  'SearchStringExact' => false,
768 
769  /// String address values
770  'StringSearchIsAnAddress' => false,
771  'SearchStringRadius' => 0,
772 
773  /// Location radius values
774  'geo_width' => 0,
775  'geo_width_km' => 0,
776  'long_val' => 0,
777  'lat_val' => 0,
778 
779  /// Meeting data items (Array of keys completed at runtime)
780  'meeting_key' => array (),
781  'meeting_key_value' => '',
782  'meeting_key_match_case' => false,
783  'meeting_key_contains' => false,
784 
785  /// Sorting
786  'sort_key' => array ( 'weekday' => true,
787  'time' => false,
788  'town' => false
789  ),
790  'sort_dir' => array ( 'asc' => true,
791  'desc' => false
792  ),
793  'sort_results_by_distance' => false, ///< This allows a sort of the results by distance.
794 
795  /// Service body IDs (Array of keys completed at runtime)
796  'services' => array (),
797 
798  /// Meeting IDs -Array of values filled by implementor
799  'meeting_ids' => array (),
800 
801  /// Formats (Array of keys completed at runtime)
802  'formats' => array (),
803 
804  /// Languages (Array of keys completed at runtime)
805  'langs' => array (),
806 
807  /// This allows filtered responses.
808  'data_field_key' => null
809  );
810  }
811 
812  /************************************************************************************//**
813  * \brief Flush all the parameters, and the dynamically-filled outgoing ones. *
814  ****************************************************************************************/
815  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
816  public function flush_parameters()
817  {
818  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
819  $this->set_m_server_version(null);
820  $this->set_m_current_transaction(null);
821  $this->set_default_outgoing();
822  $this->clear_m_error_message();
823  }
824 
825  /************************************************************************************//**
826  * \brief Read all the standard parameters from the server *
827  * *
828  * This will set or clear the internal $m_error_message data member. *
829  ****************************************************************************************/
830  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
832  {
833  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
834  // We start off with a clean slate.
835  $this->clear_m_error_message();
836  $this->set_m_outgoing_parameter('meeting_key', array());
837  $this->set_m_outgoing_parameter('services', array());
838  $this->set_m_outgoing_parameter('formats', array());
839  $this->set_m_outgoing_parameter('langs', array());
840  // Now, we get the values from the server.
841  $this->get_server_formats();
842  if (!$this->get_m_error_message()) {
843  $this->get_server_langs();
844  if (!$this->get_m_error_message()) {
845  $this->get_server_service_bodies();
846  if (!$this->get_m_error_message()) {
847  $this->get_server_meeting_keys();
848  }
849  }
850  }
851  }
852 
853  /************************************************************************************//**
854  * \brief Execute a meeting search transaction *
855  * *
856  * \returns An array of meeting data (mixed). Each element of the array will, itself, *
857  * be an array, and will contain the meeting data. Null if no meetings were found. *
858  ****************************************************************************************/
859  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
860  public function meeting_search()
861  {
862  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
863  $ret = null;
864 
865  $error_message = null; // We will collect any error messages.
866 
867  // We start by clearing any internal error message.
868  $this->set_m_error_message($error_message);
869 
870  $uri = $this->get_m_root_uri(); // Get the cleaned URI.
871 
872  // For meeting searches, we ask for the response to be compressed, as it can be verbose.
873  $uri .= '/client_interface/json/?switcher=GetSearchResults'; // We will load the JSON.
874 
875  $serialized_list = null;
876 
877  if ($transaction_params = $this->build_transaction_parameter_list($serialized_list)) {
878  $uri .= $transaction_params;
879  }
880  // Get the JSON data from the remote server. We will use GET.
881  $data = self::call_curl($uri, false, $error_message);
882 
883  $ret['uri'] = $uri;
884  $ret['serialized'] = $serialized_list;
885 
886  // Save any internal error message from the transaction.
887  $this->set_m_error_message($error_message);
888 
889  if (!$this->get_m_error_message() && $data) {
890  // We now have a whole bunch of meetings. Time to process the response, and turn it into usable data.
891 
892  if ($data && $data !== '{}' && $data !== '[]') {
893  $data = json_decode($data, true);
894  foreach ($data as $meeting) {
895  $item = self::extract_meeting_data($meeting);
896  // Needs to be a valid meeting.
897  if ($item) {
898  // We save each meeting in an element with its ID as the key.
899  $ret['meetings'][] = $item;
900  }
901  }
902  }
903  } elseif (!$this->get_m_error_message()) {
904  $this->set_m_error_message('meeting_search: Invalid URI (' . $uri . ')');
905  }
906 
907  return $ret;
908  }
909 
910  /************************************************************************************//**
911  * \brief Unserialize a serialized transaction. *
912  * *
913  * This allows you to save a transaction, and re-use it. The transaction is not *
914  * executed. You still need to call meeting_search(). However, this replaces the setup *
915  * steps (set_current_transaction_parameter). It clears the transaction parameters *
916  * before it starts, so you cannot rely on any previous data being in the transaction *
917  * array. You can add transaction data afterward. *
918  * *
919  * \returns An array of string. If any of the given parameters cannot be set, their *
920  * key is given here. It is not an error. Null if everything fit. *
921  ****************************************************************************************/
922  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
923  public function apply_serialized_transaction($in_serialized_list) ///< A string that holds the serialized transaction list.
924  {
925  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
926  $ret = null;
927 
928  $new_array = unserialize($in_serialized_list);
929  if (isset($new_array) && is_array($new_array) && count($new_array)) {
930  $ret = array();
931  $this->set_m_current_transaction(null); // Clear current transactions.
932  foreach ($new_array as $param_key => $param_value) {
933  if ($this->is_legal_transaction_key($param_key, $param_value)) {
934  $this->set_current_transaction_parameter($param_key, $param_value);
935  } else {
936  $ret[] = $param_key;
937  }
938  }
939  }
940 
941  return $ret;
942  }
943 
944  /************************************************************************************//**
945  * \brief Return the query parameter list for the next transaction in a serialized *
946  * string. *
947  * *
948  * \returns A string. The transaction parameter list in a serialized form. *
949  ****************************************************************************************/
950  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
951  public function get_serialized_transaction()
952  {
953  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
954  return serialize($this->get_m_current_transaction());
955  }
956 
957  /************************************************************************************//**
958  * \brief Return the query parameter list for the next transaction. *
959  * *
960  * \returns A string. The transaction parameter list. *
961  ****************************************************************************************/
962  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
963  private function build_transaction_parameter_list(&$in_out_serialized_list) ///< A reference to a string that will hold the serialized transaction list.
964  {
965  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
966  $ret = null;
967 
968  $transaction_array =& $this->get_m_current_transaction();
969 
970  if (is_array($transaction_array) && count($transaction_array)) {
971  foreach ($transaction_array as $param_key => &$param_value) {
972  if ($this->is_legal_transaction_key($param_key, $param_value)) {
973  if (is_array($transaction_array[$param_key]) && (count($transaction_array[$param_key]) > 1)) {
974  foreach ($transaction_array[$param_key] as $param) {
975  $ret .= '&';
976  if ($param === true) { // Boolean is converted to a "1"
977  $param = 1;
978  }
979  $ret .= $param_key . '[]=' . urlencode(trim(strval($param)));
980  }
981  } elseif ((is_array($transaction_array[$param_key]) && (count($transaction_array[$param_key]) == 1)) || (!is_array($transaction_array[$param_key]) && isset($transaction_array[$param_key]))) {
982  $ret .= '&';
983  $param = $transaction_array[$param_key];
984  if (is_array($param)) {
985  $param = $param[0];
986  }
987  if ($param === true) { // Boolean is converted to a "1"
988  $param = 1;
989  }
990  $ret .= $param_key . '=' . urlencode(trim(strval($param)));
991  } else {
992  $this->set_m_error_message('build_transaction_parameter_list: Invalid Parameter Value: "' . $param_value . '" (' . $param_key . ')');
993  break;
994  }
995  } else {
996  $this->set_m_error_message('build_transaction_parameter_list: Invalid Parameter Key: "' . $param_key . '"');
997  break;
998  }
999  }
1000  }
1001 
1002  // This will be used to allow persistent state.
1003  $in_out_serialized_list = $this->get_serialized_transaction();
1004  return $ret;
1005  }
1006 
1007  /****************************************************************************************
1008  * STATIC FUNCTIONS *
1009  ****************************************************************************************/
1010 
1011  /************************************************************************************//**
1012  * \brief Accessor -Return the array of supported protocols. *
1013  * *
1014  * \returns An array of strings. *
1015  ****************************************************************************************/
1016  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
1017  public static function get_m_supported_protocols()
1018  {
1019  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
1020  return self::$m_supported_protocols;
1021  }
1022 
1023 
1024  /************************************************************************************//**
1025  * \brief Extracts the data from one meeting. *
1026  * *
1027  * \returns An associative array, with all the meeting data. *
1028  ****************************************************************************************/
1029  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
1030  private static function extract_meeting_data($in_meeting_item)
1031  {
1032  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
1033  $ret = null;
1034 
1035  foreach ($in_meeting_item as $key => $value) {
1036  if ($value) {
1037  $ret[$key] = $value;
1038  }
1039  }
1040 
1041  return $ret;
1042  }
1043 
1044  /************************************************************************************//**
1045  * \brief This is a function that returns the results of an HTTP call to a URI. *
1046  * It is a lot more secure than file_get_contents, but does the same thing. *
1047  * *
1048  * \returns a string, containing the response. Null if the call fails to get any data. *
1049  ****************************************************************************************/
1050  // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
1051  public static function call_curl(
1052  $in_uri, ///< A string. The URI to call.
1053  $in_post = false, ///< If false, the transaction is a GET, not a POST. Default is true.
1054  &$error_message = null, ///< A string. If provided, any error message will be placed here.
1055  &$http_status = null ///< Optional reference to a string. Returns the HTTP call status.
1056  ) {
1057  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
1058  $ret = null;
1059 
1060  // Make sure we don't give any false positives.
1061  if ($error_message) {
1062  $error_message = null;
1063  }
1064 
1065  if (!extension_loaded('curl')) { // Must have cURL.
1066  // If there is no error message variable passed, we die quietly.
1067  if (isset($error_message)) {
1068  $error_message = 'call_curl: The cURL extension is not available! This code will not work on this server!';
1069  }
1070  } else {
1071  // This gets the session as a cookie.
1072  if (isset($_COOKIE['PHPSESSID']) && $_COOKIE['PHPSESSID']) {
1073  $strCookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'] . '; path=/';
1074 
1075  session_write_close();
1076  }
1077 
1078  // Create a new cURL resource.
1079  $resource = curl_init();
1080 
1081  if (isset($strCookie) && $strCookie) {
1082  curl_setopt($resource, CURLOPT_COOKIE, $strCookie);
1083  }
1084 
1085  // If we will be POSTing this transaction, we split up the URI.
1086  if ($in_post) {
1087  curl_setopt($resource, CURLOPT_POST, true);
1088 
1089  $spli = explode("?", $in_uri, 2);
1090 
1091  if (is_array($spli) && (1 < count($spli))) {
1092  $in_uri = $spli[0];
1093  $in_params = $spli[1];
1094  // Convert query string into an array using parse_str(). parse_str() will decode values along the way.
1095  parse_str($in_params, $temp);
1096 
1097  // Now rebuild the query string using http_build_query(). It will re-encode values along the way.
1098  // It will also take original query string params that have no value and appends a "=" to them
1099  // thus giving them and empty value.
1100  $in_params = http_build_query($temp);
1101 
1102  curl_setopt($resource, CURLOPT_POSTFIELDS, $in_params);
1103  }
1104  }
1105 
1106  if (isset($strCookie) && $strCookie) {
1107  curl_setopt($resource, CURLOPT_COOKIE, $strCookie);
1108  }
1109 
1110  // Set url to call.
1111  curl_setopt($resource, CURLOPT_URL, $in_uri);
1112 
1113  // Make curl_exec() function (see below) return requested content as a string (unless call fails).
1114  curl_setopt($resource, CURLOPT_RETURNTRANSFER, true);
1115 
1116  // By default, cURL prepends response headers to string returned from call to curl_exec().
1117  // You can control this with the below setting.
1118  // Setting it to false will remove headers from beginning of string.
1119  // If you WANT the headers, see the Yahoo documentation on how to parse with them from the string.
1120  curl_setopt($resource, CURLOPT_HEADER, false);
1121 
1122  // Allow cURL to follow any 'location:' headers (redirection) sent by server (if needed set to true, else false- defaults to false anyway).
1123 // Disabled, because some servers disable this for security reasons.
1124 // curl_setopt ( $resource, CURLOPT_FOLLOWLOCATION, true );
1125 
1126  // Set maximum times to allow redirection (use only if needed as per above setting. 3 is sort of arbitrary here).
1127  curl_setopt($resource, CURLOPT_MAXREDIRS, 3);
1128 
1129  // Set connection timeout in seconds (very good idea).
1130  curl_setopt($resource, CURLOPT_CONNECTTIMEOUT, 10);
1131 
1132  // Direct cURL to send request header to server allowing compressed content to be returned and decompressed automatically (use only if needed).
1133  curl_setopt($resource, CURLOPT_ENCODING, 'gzip,deflate');
1134 
1135  // Pretend we're a browser, so that anti-cURL settings don't pooch us.
1136  curl_setopt($resource, CURLOPT_USERAGENT, "cURL Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20130401 Firefox/21.0");
1137 
1138  // Trust meeeee...
1139  curl_setopt($resource, CURLOPT_SSL_VERIFYPEER, false);
1140 
1141  // Execute cURL call and return results in $content variable.
1142  $content = curl_exec($resource);
1143 
1144  // Check if curl_exec() call failed (returns false on failure) and handle failure.
1145  if ($content === false) {
1146  // If there is no error message variable passed, we die quietly.
1147  if (isset($error_message)) {
1148  // Cram as much info into the error message as possible.
1149  $error_message = "call_curl: curl failure calling $in_uri, " . curl_error($resource) . "\n" . curl_errno($resource);
1150  }
1151  } else {
1152  // Do what you want with returned content (e.g. HTML, etc) here or AFTER curl_close() call below as it is stored in the $content variable.
1153 
1154  // You MIGHT want to get the HTTP status code returned by server (e.g. 200, 400, 500).
1155  // If that is the case then this is how to do it.
1156  $http_status = curl_getinfo($resource, CURLINFO_HTTP_CODE);
1157  }
1158 
1159  // Close cURL and free resource.
1160  curl_close($resource);
1161 
1162  // Maybe echo $contents of $content variable here.
1163  if ($content !== false) {
1164  $ret = $content;
1165  }
1166  }
1167 
1168  return $ret;
1169  }
1170 }
Provides low-level communication to the BMLT Root Server.
& get_m_current_transaction()
Accessor -Return a reference to the class transaction "bucket." * *.
is_legal_transaction_key( $in_parameter_key, $in_sub_key=null)
See if a given parameter key is valid for an outgoing parameter. * *.
& get_m_outgoing_parameter( $in_parameter_key_string, $in_parameter_secondary_key_string=null)
Return a value from the transaction stimuli array. * *.
& get_m_outgoing_parameters()
Accessor -Return the transaction stimulus array. * *.
get_transaction_key_values($in_parameter_key)
See if a given parameter key is valid for an outgoing parameter. *This will set or clear the error me...
get_server_service_bodies($in_force_refresh=false)
Return the server's Service bodies, in hierarchical fashion. *This will cache the response in the out...
get_server_meeting_keys($in_force_refresh=false)
Return a list of the supported meeting_key values.. *Each root server can define its own meeting data...
get_server_version($in_force_refresh=false)
Test the stored URI to see if it points to a valid root server, and return * the server version....
set_m_root_uri( $in_root_uri_string, $in_skip_flush=false)
Accessor -Set the value of the Root URI. *NOTE: If the server URI changes, the parameters are flushed...
meeting_search()
Execute a meeting search transaction * *.
set_current_transaction_parameter( $in_parameter_key, $in_parameter_value=null)
Add a transaction parameter to a transaction being built. *This will set or clear the error message....
get_m_error_message()
Accessor -Return the value of the class error message (if any). * *.
load_standard_outgoing_parameters()
Read all the standard parameters from the server *This will set or clear the internal $m_error_messag...
get_serialized_transaction()
Return the query parameter list for the next transaction in a serialized * string....
static get_m_supported_protocols()
Accessor -Return the array of supported protocols. * *.
get_server_formats($in_force_refresh=false)
Return the server supported formats. *This will cache the response in the outgoing parameters ('forma...
__construct($in_root_uri_string=null)
Constructor -Set the value of the Root URI. * If a URI is passed in, then the object establishes and ...
static call_curl( $in_uri, $in_post=false, &$error_message=null, &$http_status=null)
This is a function that returns the results of an HTTP call to a URI. * It is a lot more secure than ...
get_meeting_changes( $in_start_date=null, $in_end_date=null, $in_meeting_id=null, $in_service_body_id=null)
Return meeting changes between two dates. *This requires that the server be version 1....
apply_serialized_transaction($in_serialized_list)
Unserialize a serialized transaction. *This allows you to save a transaction, and re-use it....
flush_parameters()
Flush all the parameters, and the dynamically-filled outgoing ones. *.
get_m_root_uri()
Accessor -Return the value of the Root URI. Perform "cleaning" if necessary. * *.
get_server_langs($in_force_refresh=false)
Return the server supported languages. *This will cache the response in the outgoing parameters ('lan...
set_m_outgoing_parameter( $in_parameter_key_string, $in_parameter_value_mixed)
Set a parameter value to the transaction stimulus array. *The outgoing array is "pre-keyed" with the ...
clear_m_error_message()
Clear the Error Message. *.