Exemple #1
0
 /**
  * Called when the <head> tags are rendered.
  */
 function wp_head()
 {
     if (!isset($this->plugin)) {
         return;
     }
     if (!isset($this->plugin->settings)) {
         return;
     }
     if (!is_object($this->plugin->settings)) {
         return;
     }
     $this->plugin->loadPluginData();
     echo '<!-- SLP Custom CSS -->' . "\n" . '<style type="text/css">' . "\n" . "div#sl_div div#map {\n" . "width:{$this->plugin->data['sl_map_width']}{$this->plugin->data['sl_map_width_units']};\n" . "height:{$this->plugin->data['sl_map_height']}{$this->plugin->data['sl_map_height_units']};\n" . "}\n" . "div#sl_div div#slp_tagline {\n" . "width:{$this->plugin->data['sl_map_width']}{$this->plugin->data['sl_map_width_units']};\n" . "}\n" . apply_filters('slp_ui_headers', '') . '</style>' . "\n\n";
 }
Exemple #2
0
 /**
  * Localize the CSL Script
  */
 public function localizeSLPScript()
 {
     $this->slplus->debugMP('slp.main', 'msg', 'SLPlus_UI:' . __FUNCTION__);
     $this->slplus->loadPluginData();
     // Handle any IconAttributes optionally set using the shortcode in combination with the Pro Pack
     $this->handleIconAttributes('sl_map_home_icon', 'homeicon');
     $this->handleIconAttributes('sl_map_end_icon', 'endicon');
     $slplus_home_icon_file = str_replace(SLPLUS_ICONURL, SLPLUS_ICONDIR, $this->slplus->data['sl_map_home_icon']);
     $slplus_end_icon_file = str_replace(SLPLUS_ICONURL, SLPLUS_ICONDIR, $this->slplus->data['sl_map_end_icon']);
     $this->slplus->data['home_size'] = function_exists('getimagesize') && file_exists($slplus_home_icon_file) ? getimagesize($slplus_home_icon_file) : array(0 => 20, 1 => 34);
     $this->slplus->data['end_size'] = function_exists('getimagesize') && file_exists($slplus_end_icon_file) ? getimagesize($slplus_end_icon_file) : array(0 => 20, 1 => 34);
     add_shortcode('slp_location', array($this, 'process_slp_location_Shortcode'));
     // Load up some basic options.
     // This can probably be handled better.
     //
     $this->slplus->options['use_sensor'] = get_option(SLPLUS_PREFIX . '_use_location_sensor', 0) == 1;
     // Set starting map center
     //
     $this->slplus->options['map_center'] = $this->set_MapCenter();
     // Lets get some variables into our script.
     // "Higher Level" JS Options are those noted below.
     //
     // TODO: ALL of these options should go inside the options property other than plugin_url, core_url.
     //
     $scriptData = array('plugin_url' => SLPLUS_PLUGINURL, 'disable_scroll' => get_option(SLPLUS_PREFIX . '_disable_scrollwheel') == 1, 'map_3dcontrol' => get_option(SLPLUS_PREFIX . '_disable_largemapcontrol3d') == 0, 'map_home_icon' => $this->slplus->data['sl_map_home_icon'], 'map_home_sizew' => $this->slplus->data['home_size'][0], 'map_home_sizeh' => $this->slplus->data['home_size'][1], 'map_end_icon' => $this->slplus->data['sl_map_end_icon'], 'map_end_sizew' => $this->slplus->data['end_size'][0], 'map_end_sizeh' => $this->slplus->data['end_size'][1], 'map_scalectrl' => get_option(SLPLUS_PREFIX . '_disable_scalecontrol') == 0, 'map_type' => get_option('sl_map_type', 'roadmap'), 'map_typectrl' => get_option(SLPLUS_PREFIX . '_disable_maptypecontrol') == 0, 'msg_noresults' => $this->slplus->settings->get_item('message_noresultsfound', 'No results found.', '_'), 'results_string' => $this->set_ResultsLayout(false), 'overview_ctrl' => get_option('sl_map_overview_control', 0), 'zoom_tweak' => get_option('sl_zoom_tweak', 1), 'options' => apply_filters('slp_js_options', $this->slplus->options));
     $this->slplus->debugMP('slp.main', 'pr', 'Script Data', $scriptData);
     remove_shortcode('slp_location');
     // AJAX URL Stuff
     //
     $scriptData['ajaxurl'] = admin_url('admin-ajax.php');
     $scriptData['nonce'] = wp_create_nonce('em');
     // FILTER: slp_script_data
     //
     $scriptData = apply_filters('slp_script_data', $scriptData);
     wp_localize_script('csl_script', 'slplus', $scriptData);
 }