getInfo(); /** @var array $settings */ if ($settings['debug_output']){ $debug->addInfoString("Plugin info:"); $debug->addInfoString($info); } $global_settings=$debug->readGlobalSettings(); $markers = array(); $width = $settings['width'] == 'auto' ? 'auto' : ((int)$settings['width']).'px'; $height = $settings['height'] == 'auto' ? '300px' : ((int)$settings['height']).'px'; $zoom_phone_portrait=$settings['zoom']; $zoom_phone_landscape=is_numeric($settings['zoom_phone_h']) ? $settings['zoom_phone_h'] : $zoom_phone_portrait; $zoom_tablet=is_numeric($settings['zoom_tablet']) ? $settings['zoom_tablet'] : $zoom_phone_landscape; $zoom_desktop=is_numeric($settings['zoom_desktop']) ? $settings['zoom_desktop'] : $zoom_tablet; $zoom_large=is_numeric($settings['zoom_large']) ? $settings['zoom_large'] : $zoom_desktop; // Markers $item_id=0; $debug_items=array(); if ($settings['debug_output']) $debug->addInfoString('Content items:'); /** @var array $items */ foreach ($items as $i => $item) { $item_id++; $debug_item = []; if ($settings['debug_output']){ $debug_item=WidgetkitExPlugin::intersectArrayItems($item,array( 'location', 'title', 'content', 'media', 'custom_pin_path', 'custom_pin_anchor_x', 'custom_pin_anchor_y' )); $debug_item['item_id']=$item_id; } $debug_item['comments']=''; if (isset($item['location']) && $item['location']) { $marker = array( 'lat' => $item['location']['lat'], 'lng' => $item['location']['lng'], 'title' => $item['title'], 'id' => $map_id."-marker-".$item_id, 'content' => '', 'pin' => '', 'anchor_x' => '', 'anchor_y' => '' ); if (($item['title'] && $settings['title']) || ($item['content'] && $settings['content']) || ($item['media'] && $settings['media'])) { /** @var object $widget */ $marker['content'] = $app->convertUrls($this->render('plugins/widgets/' . $widget->getConfig('name') . '/views/_content.php', compact('item', 'settings'))); } if ($settings['pin_type']==''){ $pinoverride=false; if (strlen($item['custom_pin_path'])>0){ $marker['pin']=trim($item['custom_pin_path']); $pinoverride=true; $debug_item['PinType']='Unique custom'; } else{ $marker['pin']=trim($settings['custom_pin_path']); $debug_item['PinType']='Global custom'; } if (strlen($marker['pin'])>0){ //Checking for absolute URL if ( (substr($marker['pin'], 0, 7) != 'http://') && (substr($marker['pin'], 0, 8) != 'https://') && (substr($marker['pin'], 0, 2) != '//') && (strlen($marker['pin'])>2) ){ if (substr($marker['pin'], 0, 1) != '/') $markerurl=$marker['pin']; else $markerurl=substr($marker['pin'], 1); $marker['pin']=$debug->getWebsiteRootURL().$markerurl; } $debug_item['finalPinURL']=$marker['pin']; if ($settings['debug_output']) if (WidgetkitExPlugin::url_exists($marker['pin'])) $debug_item['finalPinURLisValid']=true; else $debug_item['finalPinURLisValid']=false; if ( ($pinoverride) && (is_numeric($item['custom_pin_anchor_x'])) && (is_numeric($item['custom_pin_anchor_y'])) ) { $marker['anchor_x']=intval($item['custom_pin_anchor_x']); $marker['anchor_y']=intval($item['custom_pin_anchor_y']); } else if ( (!$pinoverride) && (is_numeric($settings['custom_pin_anchor_x'])) && (is_numeric($settings['custom_pin_anchor_y'])) ) { $marker['anchor_x']=intval($settings['custom_pin_anchor_x']); $marker['anchor_y']=intval($settings['custom_pin_anchor_y']); } } else $debug_item['PinType']='Default'; $debug_item['comments'].='The custom image path is empty. The deafult pin image will be used.'; } else{ $debug_item['PinType']='Default'; if (strlen($item['custom_pin_path'])>0) $debug_item['comments'].="You have defined a custom unique pin image. However, this image will be ignored. To use custom images you must select 'Custom' as the 'Marker Pin Icon' option in the widget's settings. Ignore this message if the widget works as you expect."; } $markers[] = $marker; } else $debug->addWarningString('The location is missing for item#'.$item_id.'. This item will be ignored.'); if ($settings['debug_output']) array_push($debug_items,$debug_item); } if ($settings['debug_output']) $debug->addInfoString($debug_items); $settings['map_id'] = $map_id; $settings['map_id2'] = $map_id2; if (!empty($settings['map_center'])){ $center=explode(',',$settings['map_center']); if ( (sizeof($center)==2) && (is_numeric($center[0])) && (is_numeric($center[1])) ){ $settings['center_lat'] = $center[0]; $settings['center_lng'] = $center[1]; } } $settings['clusterstyles']=[]; //Checking the sizes of cluster images if ($settings['markercluster']=='custom'){ $styles=[]; for ($i=0; $i2) ){ if (substr($cstyle['url'], 0, 1) != '/') $markerurl=$cstyle['url']; else $markerurl=substr($cstyle['url'], 1); $cstyle['url']=$debug->getWebsiteRootURL().$markerurl; } if (!is_numeric($settings['clusters'][$i]['width'])) $cstyle['width']=($settings['clusters'][$i]['options']['width'] > 0) ? intval($settings['clusters'][$i]['options']['width']) : 53; else $cstyle['width']=intval($settings['clusters'][$i]['width']); if (!is_numeric($settings['clusters'][$i]['height'])) $cstyle['height']=($settings['clusters'][$i]['options']['height'] > 0) ? intval($settings['clusters'][$i]['options']['height']) : 53; else $cstyle['height']=intval($settings['clusters'][$i]['height']); $cstyle['textSize']=is_numeric($settings['clusters'][$i]['textSize']) ? intval($settings['clusters'][$i]['textSize']) : 11; $cstyle['textColor']=($settings['clusters'][$i]['textColor']) ? $settings['clusters'][$i]['textColor'] : 'black'; if ( (is_numeric($settings['clusters'][$i]['icon_anchor_x'])) && (is_numeric($settings['clusters'][$i]['icon_anchor_y'])) ) $cstyle['iconAnchor']=[intval($settings['clusters'][$i]['icon_anchor_x']), intval($settings['clusters'][$i]['icon_anchor_y'])]; //X and Y are inversed: $cstyle['anchor']=[is_numeric($settings['clusters'][$i]['label_anchor_y']) ? intval($settings['clusters'][$i]['label_anchor_y']) : 0, is_numeric($settings['clusters'][$i]['label_anchor_x']) ? intval($settings['clusters'][$i]['label_anchor_x']) : 0]; array_push($styles,$cstyle); } $settings['clusterstyles']=$styles; } ?>
'.$markers[$i]['content'].''; unset($markers[$i]['content']); } $settings['markers'] = $markers; if ($settings['debug_output']){ $debug->addInfoString('Widget settings:'); $debug->addInfoString($settings); } ?>