BMLT Basic Standalone Satellite
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
bmlt_basic Class Reference
Inheritance diagram for bmlt_basic:

Public Member Functions

 output_head ($in_shortcode='[[bmlt]]')
 Outputs the head HTML, CSS and JavaScript. *. More...
 
 output_body ()
 Outputs the body HTML and JavaScript. *.
 
 process_text ($in_string)
 This uses the CMS text processor (t) to process the given string. *

  • This allows easier translation of displayed strings. All strings displayed by the * plugin should go through this function. * *.
More...
 
 standard_head ($in_text=null)
 returns any necessary head content. * More...
 
 admin_head ()
 No admin in this implementation. * *. More...
 
 admin_page ()
 Prevents the admin page from being shown. *.
 

Public Attributes

 $my_shortcode = null
 This will hold the given shortcode.
 

Protected Member Functions

 get_ajax_base_uri ()
 Return an HTTP path to the AJAX callback target. * *. More...
 
 get_plugin_path ()
 Return an HTTP path to the plugin directory. * *. More...
 
 geDefaultBMLTOptions ()
 This gets the default admin options from the object (not the DB). * *. More...
 
 cms_get_option ($in_option_key)
 This gets the admin options from the config file. * *. More...
 
 cms_get_page_settings_id ( $in_text, $in_check_mobile=false)
 This function fetches the settings ID for a page (if there is one). *

  • If $in_check_mobile is set to true, then ONLY a check for mobile support will be * made, and no other shortcodes will be checked. * *.
More...
 
 get_admin_ajax_base_uri ()
 We don't do admin in this variant, so this makes that clear. * *. More...
 
 get_admin_form_uri ()
 We don't do admin in this variant, so this makes that clear. * *. More...
 
 cms_set_option ( $in_option_key, $in_option_value)
 You cannot set options in this implementation. * *. More...
 
 cms_delete_option ($in_option_key)
 You cannot delete options in this implementation. * *. More...
 
 cms_get_post_meta ( $in_page_id, $in_settings_id)
 This is declared to make it clear that we don't do post meta. * *. More...
 

Detailed Description

Definition at line 52 of file bmlt_basic.class.php.

Member Function Documentation

◆ admin_head()

admin_head ( )

No admin in this implementation. * *.

Returns
null *

Definition at line 423 of file bmlt_basic.class.php.

424  {
425  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
426  return null;
427  }

◆ cms_delete_option()

cms_delete_option (   $in_option_key)
protected

You cannot delete options in this implementation. * *.

Returns
false *

Definition at line 397 of file bmlt_basic.class.php.

398  {
399  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
400  return false;
401  }

◆ cms_get_option()

cms_get_option (   $in_option_key)
protected

This gets the admin options from the config file. * *.

Returns
an associative array, with the option settings. *

Definition at line 176 of file bmlt_basic.class.php.

177  {
178  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
180  global $bmlt_basic_configuration_index;
181 
182  $ret = null;
183 
184  if ($in_option_key != self::$admin2OptionsName) {
185  $index = intval(max($bmlt_basic_configuration_index - 1, intval(str_replace(self::$adminOptionsName . '_', '', $in_option_key))));
186 
187  $ret = $bmlt_basic_configuration[$index];
188  } else {
189  $ret = array ( 'num_servers' => $bmlt_basic_configuration_index );
190  }
191 
192  return $ret;
193  }
global $bmlt_basic_configuration
These are used by the bmlt_basic class. Don't mess with them.

References $bmlt_basic_configuration.

◆ cms_get_page_settings_id()

cms_get_page_settings_id (   $in_text,
  $in_check_mobile = false 
)
protected

This function fetches the settings ID for a page (if there is one). *

  • If $in_check_mobile is set to true, then ONLY a check for mobile support will be * made, and no other shortcodes will be checked. * *.

Returns
a mixed type, with the settings ID. *
Parameters
$in_textRequired (for the base version) content to check.
$in_check_mobileTrue if this includes a check for mobile. Default is false.

Definition at line 204 of file bmlt_basic.class.php.

207  {
208  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
209  $my_option_id = 0;
210 
211  if (!$in_check_mobile && isset($this->my_http_vars['bmlt_settings_id']) && is_array($this->getBMLTOptions($this->my_http_vars['bmlt_settings_id']))) {
212  $my_option_id = $this->my_http_vars['bmlt_settings_id'];
213  } else {
214  $support_mobile = self::get_shortcode($in_text, 'bmlt_mobile');
215 
216  if ($support_mobile === true) {
217  $options = $this->getBMLTOptions(1);
218  $support_mobile = strval($options['id']);
219  }
220 
221  if ($in_check_mobile && $support_mobile && !isset($this->my_http_vars['BMLTPlugin_mobile']) && (self::mobile_sniff_ua($this->my_http_vars) != 'xhtml')) {
222  $my_option_id = $support_mobile;
223  } elseif (!$in_check_mobile) {
224  if (isset($this->my_http_vars['bmlt_settings_id']) && intval($this->my_http_vars['bmlt_settings_id'])) {
225  $my_option_id = intval($this->my_http_vars['bmlt_settings_id']);
226  } elseif ($in_text) {
227  $my_option_id_content = parent::cms_get_page_settings_id($in_text, $in_check_mobile);
228 
229  $my_option_id = $my_option_id_content ? $my_option_id_content : $my_option_id;
230  }
231 
232  if (!$my_option_id) { // If nothing else gives, we go for the default (first) settings.
233  $options = $this->getBMLTOptions(1);
234  $my_option_id = $options['id'];
235  }
236  }
237  }
238 
239  return $my_option_id;
240  }

Referenced by standard_head().

◆ cms_get_post_meta()

cms_get_post_meta (   $in_page_id,
  $in_settings_id 
)
protected

This is declared to make it clear that we don't do post meta. * *.

Returns
null *
Parameters
$in_page_idThe ID of the page/post
$in_settings_idThe ID of the meta tag to fetch

Definition at line 409 of file bmlt_basic.class.php.

412  {
413  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
414  return null;
415  }

◆ cms_set_option()

cms_set_option (   $in_option_key,
  $in_option_value 
)
protected

You cannot set options in this implementation. * *.

Returns
false *
Parameters
$in_option_keyThe name of the option
$in_option_valuethe values to be set (associative array)

Definition at line 383 of file bmlt_basic.class.php.

386  {
387  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
388  return false;
389  }

◆ geDefaultBMLTOptions()

geDefaultBMLTOptions ( )
protected

This gets the default admin options from the object (not the DB). * *.

Returns
an associative array, with the default option settings. *

Definition at line 162 of file bmlt_basic.class.php.

163  {
164  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
166  // These are the defaults. If the saved option has a different value, it replaces the ones in here.
167  return $bmlt_basic_configuration[0];
168  }

References $bmlt_basic_configuration.

◆ get_admin_ajax_base_uri()

get_admin_ajax_base_uri ( )
protected

We don't do admin in this variant, so this makes that clear. * *.

THESE ARE ALL DISABLED IN THE BASIC SATELLITE *

Returns
null *

Definition at line 359 of file bmlt_basic.class.php.

360  {
361  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
362  return null;
363  }

◆ get_admin_form_uri()

get_admin_form_uri ( )
protected

We don't do admin in this variant, so this makes that clear. * *.

Returns
null *

Definition at line 371 of file bmlt_basic.class.php.

372  {
373  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
374  return null;
375  }

◆ get_ajax_base_uri()

get_ajax_base_uri ( )
protected

Return an HTTP path to the AJAX callback target. * *.

INTERNAL FUNCTIONS (NOT CALLED BY CLIENT) *

Returns
a string, containing the path. *

Definition at line 94 of file bmlt_basic.class.php.

95  {
96  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
97  // We try to account for SSL and unusual TCP ports.
98  $port = null;
99  $https = false;
100  $from_proxy = array_key_exists("HTTP_X_FORWARDED_PROTO", $_SERVER);
101  if ($from_proxy) {
102  // If the port is specified in the header, use it. If not, default to 80
103  // for http and 443 for https. We can't trust what's in $_SERVER['SERVER_PORT']
104  // because something in front of the server is fielding the request.
105  $https = $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';
106  if (array_key_exists("HTTP_X_FORWARDED_PORT", $_SERVER)) {
107  $port = intval($_SERVER['HTTP_X_FORWARDED_PORT']);
108  } elseif ($https) {
109  $port = 443;
110  } else {
111  $port = 80;
112  }
113  } else {
114  $port = $_SERVER['SERVER_PORT'];
115  // IIS puts "off" in the HTTPS field, so we need to test for that.
116  $https = (!empty($_SERVER['HTTPS']) && (($_SERVER['HTTPS'] !== 'off') || ($port == 443)));
117  }
118  $server_path = $_SERVER['SERVER_NAME'];
119  $my_path = $_SERVER['PHP_SELF'];
120  $server_path .= trim((($https && ($port != 443)) || (!$https && ($port != 80))) ? ':' . $port : '', '/');
121  $server_path = 'http' . ($https ? 's' : '') . '://' . $server_path . $my_path;
122  return $server_path;
123  }

Referenced by get_plugin_path().

◆ get_plugin_path()

get_plugin_path ( )
protected

Return an HTTP path to the plugin directory. * *.

Returns
a string, containing the path. *

Definition at line 131 of file bmlt_basic.class.php.

132  {
133  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
134  $ret = isset($this->my_http_vars['base_url']) ? $this->my_http_vars['base_url'] : dirname($this->get_ajax_base_uri()) . '/bmlt-basic/vendor/bmlt/bmlt-satellite-base-class/';
135 
136  return $ret;
137  }
get_ajax_base_uri()
Return an HTTP path to the AJAX callback target. * *.

References get_ajax_base_uri().

Referenced by standard_head().

◆ output_head()

output_head (   $in_shortcode = '[[bmlt]]')

Outputs the head HTML, CSS and JavaScript. *.

CLIENT FUNCTIONS *

< You need to provide a shortcode, if you want something other than the default.

Definition at line 66 of file bmlt_basic.class.php.

67  {
68  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
69  ///< You need to provide a shortcode, if you want something other than the default.
70  $this->my_shortcode = $in_shortcode; // Save this.
71  echo $this->standard_head($this->my_shortcode);
72  }
standard_head($in_text=null)
returns any necessary head content. *

References standard_head().

◆ process_text()

process_text (   $in_string)

This uses the CMS text processor (t) to process the given string. *

  • This allows easier translation of displayed strings. All strings displayed by the * plugin should go through this function. * *.

Returns
a string, processed by WP. *

Definition at line 148 of file bmlt_basic.class.php.

149  {
150  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
151  $in_string = htmlspecialchars($in_string);
152 
153  return $in_string;
154  }

◆ standard_head()

standard_head (   $in_text = null)

returns any necessary head content. *

< This is the page content text.

Definition at line 246 of file bmlt_basic.class.php.

247  {
248  // phpcs:enable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
249  ///< This is the page content text.
250  $this->ajax_router();
251  $load_head = false; // This is a throwback. It prevents the GM JS from being loaded if there is no directly specified settings ID.
252  $head_content = "<!-- Added by the BMLT plugin 3.X. -->\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\" /><meta http-equiv=\"Content-Style-Type\" content=\"text/css\" /><meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\" />";
253 
254  $support_mobile = $this->cms_get_page_settings_id($in_text, true);
255 
256  if ($support_mobile) {
257  $mobile_options = $this->getBMLTOptions_by_id($support_mobile);
258  } else {
259  $support_mobile = null;
260  }
261 
262  $options = $this->getBMLTOptions_by_id($this->cms_get_page_settings_id($in_text));
263 
264  if ($support_mobile && is_array($mobile_options) && count($mobile_options)) {
265  $mobile_url = $_SERVER['PHP_SELF'] . '?BMLTPlugin_mobile&bmlt_settings_id=' . $support_mobile;
266 
267  if (isset($this->my_http_vars['WML'])) {
268  $mobile_url .= '&WML=' . intval($this->my_http_vars['WML']);
269  }
270  if (isset($this->my_http_vars['simulate_smartphone'])) {
271  $mobile_url .= '&simulate_smartphone';
272  }
273 
274  if (ob_get_contents()) {
275  ob_end_clean();
276  }
277 
278  header("location: $mobile_url");
279  die();
280  }
281 
282  $load_server_header = $this->get_shortcode($in_text, 'bmlt');
283 
284  $this->my_http_vars['start_view'] = $options['bmlt_initial_view'];
285 
286  $this->load_params();
287 
288  $root_server_root = $options['root_server'];
289 
290  $head_content .= '<meta name="BMLT-Root-URI" content="' . htmlspecialchars($root_server_root) . '" />';
291 
292  $head_content .= "\n" . '<style type="text/css">' . "\n";
293  $temp = self::stripFile("styles.css", $options['theme']);
294  if ($temp) {
295  $image_dir_path = $this->get_plugin_path() . '/themes/' . $options['theme'] . '/images/';
296  $temp = str_replace('##-IMAGEDIR-##', $image_dir_path, $temp);
297  $head_content .= "\t$temp\n";
298  }
299  $temp = self::stripFile("nouveau_map_styles.css", $options['theme']);
300  if ($temp) {
301  $image_dir_path = $this->get_plugin_path() . '/themes/' . $options['theme'] . '/images/';
302  $temp = str_replace('##-IMAGEDIR-##', $image_dir_path, $temp);
303  $head_content .= "\t$temp\n";
304  }
305 
306  $head_content .= self::stripFile('table_styles.css') . "\n";
307  $head_content .= self::stripFile('quicksearch.css') . "\n";
308 
309  $dirname = ROOTPATH . '/vendor/bmlt/bmlt-satellite-base-class/themes';
310  $dir = new DirectoryIterator($dirname);
311 
312  foreach ($dir as $fileinfo) {
313  if (!$fileinfo->isDot()) {
314  $fName = $fileinfo->getFilename();
315  $temp = self::stripFile("table_styles.css", $fName);
316  if ($temp) {
317  $image_dir_path = $this->get_plugin_path() . '/themes/' . $fName . '/images/';
318  $temp = str_replace('##-IMAGEDIR-##', $image_dir_path, $temp);
319  $head_content .= "\t$temp\n";
320  }
321  $temp = self::stripFile("quicksearch.css", $fName);
322  if ($temp) {
323  $head_content .= "\t$temp\n";
324  }
325  }
326  }
327  $head_content .= self::stripFile('responsiveness.css') . "\n";
328  $head_content .= "\n</style>\n";
329  $head_content .= '<script type="text/javascript">';
330 
331  $head_content .= self::stripFile('javascript.js');
332 
333  if ($this->get_shortcode($in_text, 'bmlt_quicksearch')) {
334  $head_content .= self::stripFile('quicksearch.js') . (defined('_DEBUG_MODE_') ? "\n" : '');
335  }
336 
337  if ($this->get_shortcode($in_text, 'bmlt_map')) {
338  $head_content .= self::stripFile('map_search.js');
339  }
340 
341  if ($this->get_shortcode($in_text, 'bmlt_mobile')) {
342  $head_content .= self::stripFile('fast_mobile_lookup.js');
343  }
344 
345  $head_content .= '</script>';
346 
347  return $head_content;
348  }
get_plugin_path()
Return an HTTP path to the plugin directory. * *.
cms_get_page_settings_id( $in_text, $in_check_mobile=false)
This function fetches the settings ID for a page (if there is one). *If $in_check_mobile is set to tr...

References cms_get_page_settings_id(), and get_plugin_path().

Referenced by output_head().


The documentation for this class was generated from the following file: