Changeset 3235714
- Timestamp:
- 02/05/2025 10:26:11 PM (14 months ago)
- Location:
- yamaps
- Files:
-
- 8 edited
- 9 copied
-
tags/0.6.28 (copied) (copied from yamaps/trunk)
-
tags/0.6.28/js/btn.js (copied) (copied from yamaps/trunk/js/btn.js)
-
tags/0.6.28/js/shortcode_parser.js (copied) (copied from yamaps/trunk/js/shortcode_parser.js)
-
tags/0.6.28/languages/yamaps-ru_RU.mo (copied) (copied from yamaps/trunk/languages/yamaps-ru_RU.mo)
-
tags/0.6.28/languages/yamaps-ru_RU.po (copied) (copied from yamaps/trunk/languages/yamaps-ru_RU.po)
-
tags/0.6.28/languages/yamaps.pot (copied) (copied from yamaps/trunk/languages/yamaps.pot)
-
tags/0.6.28/options.php (copied) (copied from yamaps/trunk/options.php)
-
tags/0.6.28/readme.txt (copied) (copied from yamaps/trunk/readme.txt)
-
tags/0.6.28/yamap.php (copied) (copied from yamaps/trunk/yamap.php)
-
trunk/js/btn.js (modified) (47 diffs)
-
trunk/js/shortcode_parser.js (modified) (1 diff)
-
trunk/languages/yamaps.pot (modified) (9 diffs)
-
trunk/options.php (modified) (27 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/style.content.css (modified) (1 diff)
-
trunk/templates/tmpl-editor-yamap.html (modified) (1 diff)
-
trunk/yamap.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
yamaps/trunk/js/btn.js
r3207180 r3235714 2 2 var apikey = '', apikeyexist = false, wp_locale=tinymce.util.I18n.getCode(); 3 3 if (yamap_defaults['apikey_map_option']!='') { 4 apikey="&apikey="+ yamap_defaults['apikey_map_option'];4 apikey="&apikey="+encodeURIComponent(yamap_defaults['apikey_map_option']); 5 5 apikeyexist = true; 6 6 } 7 if (typeof wp_locale !== 'undefined') { // Защита от пустой локали. У кого-то была такая проблема7 if (typeof wp_locale !== 'undefined') { // Protection against empty locale. Some users had this problem 8 8 if (wp_locale.length<1) {wp_locale="en_US";} 9 9 } … … 11 11 wp_locale="en_US"; 12 12 } 13 script.src = "https://api-maps.yandex.ru/2.1/?lang="+ wp_locale+apikey;13 script.src = "https://api-maps.yandex.ru/2.1/?lang="+encodeURIComponent(wp_locale)+apikey; 14 14 script.setAttribute('type', 'text/javascript'); 15 15 document.getElementsByTagName('head')[0].appendChild(script); … … 18 18 var placemark = []; 19 19 20 if (!editMapAction) { //Перенесено для корректной работы вWP 5.620 if (!editMapAction) { // Moved for correct operation in WP 5.6 21 21 22 22 ym={map0: {center: coordaprox(yamap_defaults['center_map_option']), controls: yamap_defaults['controls_map_option'], height: yamap_defaults['height_map_option'], zoom: yamap_defaults['zoom_map_option'], maptype: yamap_defaults['type_map_option'], scrollzoom: optionCheck('wheelzoom_map_option'), mobiledrag: optionCheck('mobiledrag_map_option'), container: '', places: {}}}; … … 24 24 } 25 25 26 // Определяем отключен ли скролл колесом на редактируемой карте26 // Determine if scroll zoom is disabled on the edited map 27 27 function checkParam(param) { 28 28 var checker=true; … … 33 33 } 34 34 35 // Задаем дефолтные параметры из настроек35 // Set default parameters from settings 36 36 function optionCheck(param) { 37 37 var checker="0"; … … 42 42 } 43 43 44 // Определяем заголовок окна для создания или редактирования44 // Determine the window title for creating or editing 45 45 function checkTitle() { 46 46 if (editMapAction) { … … 52 52 } 53 53 54 // Дефолтные данные54 // Default data 55 55 var coords=[], mapcenter=yamap_defaults['center_map_option'], mapzoom=yamap_defaults['zoom_map_option'], maptype=yamap_defaults['type_map_option'], markicon, markcount=0, mapcount=1; 56 56 … … 60 60 61 61 62 // Изменение поля типа иконки62 // Change the icon type field 63 63 function iconselectchange() { // change icon type 64 64 if (activeplace!=='') { … … 69 69 } 70 70 71 72 73 //Округляем координаты до 4 знаков после запятой 71 // Round coordinates to 4 decimal places 74 72 function coordaprox(fullcoord) { 75 // надо сделать проверку на корректный ввод координат73 // Need to check for valid coordinate input 76 74 if (fullcoord.length!==2) { 77 75 fullcoord=fullcoord.split(','); … … 83 81 } 84 82 85 // Изменяем поле с координатами метки83 // Change the coordinates field of the marker 86 84 function markcoordchange() { 87 85 jQuery("#markercoord").val(coordaprox(ym[mapselector].places[activeplace].coord)); 88 86 } 89 87 90 // Активируем выключенное поле88 // Activate the disabled field 91 89 function enablesinglefield(field) { 92 90 jQuery(field).attr('disabled',false); … … 95 93 } 96 94 97 // Деактивируем поле95 // Deactivate the field 98 96 function disablesinglefield(field) { 99 97 jQuery(field).attr('disabled',true); … … 102 100 } 103 101 104 // Активируем выключенные поля после создания метки102 // Activate disabled fields after creating a marker 105 103 function enablefields(fieldact=true) { 106 104 if (fieldact) { … … 113 111 } 114 112 115 // Проверяем значение чекбокса113 // Check the value of the checkbox 116 114 function checkcheckbox(param) { 117 115 if (jQuery("#"+param).attr('aria-checked')!="undefined") { … … 124 122 } 125 123 126 // Изменяем данные карты в массиве после изменения полей124 // Change the map data in the array after changing fields 127 125 function mapdatechange() { 128 126 … … 149 147 } 150 148 151 // Изменяем данные карты в массиве после изменения карты в редакторе149 // Change the map data in the array after changing the map in the editor 152 150 function mapSave() { 153 151 ym[mapselector].zoom=mapzoom; … … 156 154 } 157 155 158 // Изменаем данные активной метки в массиве по данным полей ввода156 // Change the active marker data in the array based on input field data 159 157 function markchange() { 160 161 158 if (activeplace!=='') { 162 163 ym[mapselector].places[activeplace].name=jQuery("#markername").val().replace(/["]/g, '"'); 164 ym[mapselector].places[activeplace].coord=jQuery("#markercoord").val(); 165 ym[mapselector].places[activeplace].color=jQuery("#colorbox #colorbox-inp").val(); 166 ym[mapselector].places[activeplace].icon=jQuery("#markericon #markericon-inp").val(); 159 // Escape special characters in the marker name 160 var markerName = jQuery("#markername").val().replace(/[&<>"']/g, function(m) { 161 return { 162 '&': '&', 163 '<': '<', 164 '>': '>', 165 '"': '"', 166 "'": ''' 167 }[m]; 168 }); 167 169 168 ym[mapselector].places[activeplace].url=jQuery("#markerurl").val(); 169 170 } 171 } 172 173 //Изменяем данные полей ввода по данным массива 170 ym[mapselector].places[activeplace].name = markerName; 171 ym[mapselector].places[activeplace].coord = jQuery("#markercoord").val(); 172 ym[mapselector].places[activeplace].color = jQuery("#colorbox #colorbox-inp").val(); 173 ym[mapselector].places[activeplace].icon = jQuery("#markericon #markericon-inp").val(); 174 175 // Escape URL 176 var markerUrl = jQuery("#markerurl").val(); 177 if(markerUrl) { 178 try { 179 markerUrl = encodeURI(markerUrl); 180 } catch(e) { 181 markerUrl = ''; 182 } 183 } 184 ym[mapselector].places[activeplace].url = markerUrl; 185 } 186 } 187 188 // Change the input field data based on the array data 174 189 function markerfields() { 175 190 if (typeof ym[mapselector].places[activeplace].name !== 'undefined') { … … 184 199 } 185 200 186 // Выключаем поле координат, когда не выбрана метка201 // Disable the coordinates field when no marker is selected 187 202 function inactive() { 188 203 jQuery("#markercoord").val(yamap_object.NoCoord); … … 190 205 } 191 206 192 193 //Изменяем имя или хинт иконки в зависимости от ее типа 194 function iconname(place) { //change icon name 207 // Change the name or hint of the icon depending on its type 208 function iconname(place) { // change icon name 195 209 yacontent=""; 196 210 if (activeplace!=='') { … … 201 215 var yahint = ""; 202 216 203 //Если иконка тянется, выводим название в iconContent 217 // Escape the marker name for safe display 218 markername = markername ? markername.replace(/[&<>"']/g, function(m) { 219 return { 220 '&': '&', 221 '<': '<', 222 '>': '>', 223 '"': '"', 224 "'": ''' 225 }[m]; 226 }) : ''; 227 228 // If the icon is stretchy, display the name in iconContent 204 229 if (markicon.indexOf("Stretchy")!==-1) { 205 230 yahint=""; 206 231 yacontent=markername; 207 232 } 208 209 //Если круглая пустая иконка, то выводим в iconContent первый символ и название в hintContent210 233 else { 211 234 if ((markicon==="islands#blueIcon")||(markicon==="islands#blueCircleIcon")) { 212 235 yahint=markername; 213 214 236 if ((yahint!="")&&(yahint!=undefined)) { 215 237 yacontent=yahint[0]; 216 238 } 217 218 239 } 219 //Если иконка с точкой, то выводим название в hintContent220 240 else { 221 241 yahint=markername; … … 227 247 placemark[place.replace('placemark', '')].properties.set('hintContent', yahint); 228 248 placemark[place.replace('placemark', '')].properties.set('iconContent', yacontent); 229 // Проверяем, является ли поле иконки url-адресом. Если да, то ставим в качестве иконки кастомное изображение.249 // Check if the icon field is a URL. If yes, set a custom image as the icon. 230 250 if (markicon.indexOf("http")===-1) { 231 251 placemark[place.replace('placemark', '')].options.unset('iconLayout', 'default#image'); … … 236 256 placemark[place.replace('placemark', '')].options.unset('preset', markicon); 237 257 placemark[place.replace('placemark', '')].options.set('iconLayout', 'default#image'); 258 // Escape the icon URL 259 markicon = encodeURI(markicon); 238 260 placemark[place.replace('placemark', '')].options.set('iconImageHref', markicon); 239 261 } … … 241 263 } 242 264 243 244 //Работаем с редактором tinyMCE в модальном окне 265 // Work with the tinyMCE editor in the modal window 245 266 (function() { 246 267 var editor = tinymce.activeEditor; 247 268 248 // Изменяем цвет иконки на карте, записываем в массив269 // Change the icon color on the map, write to the array 249 270 function markercolor (pcolor) { 250 // Если метки нет, цвета не прописываем271 // If there is no marker, do not set the color 251 272 if (activeplace!=='') { 252 273 placemark[activeplace.replace('placemark', '')].options.set('iconColor', pcolor); … … 255 276 } 256 277 257 // Плагин colorPicker дляtinyMCE278 // ColorPicker plugin for tinyMCE 258 279 function createColorPickAction() { 259 280 … … 277 298 } 278 299 279 280 //Добавляем кнопку и меню плагина в редактор 300 // Add button and plugin menu to the editor 281 301 tinymce.create("tinymce.plugins.yamap_plugin", { 282 302 283 // url argument holds the absolute url of our plugin directory303 // url argument holds the absolute url of our plugin directory 284 304 init : function(ed, url) { 285 305 286 287 288 //add new button 306 // Add new button 289 307 ed.addButton("yamap", { 290 308 title : yamap_object.AddMap, … … 297 315 ed.execCommand("yamap_command"); 298 316 } 299 300 301 317 }); 302 318 303 304 305 306 307 //Функционал кнопки в редакторе 319 // Functionality of the button in the editor 308 320 ed.addCommand("yamap_command", function() { 309 321 activeplace=""; 310 322 markcount=0; 311 323 312 313 //Инициализируем карту 324 // Initialize the map 314 325 jQuery(document).ready(function() { 315 326 316 327 317 if (!editMapAction) { // Перенесено в начало кода из-за проблем вWP 5.6328 if (!editMapAction) { // Moved to the beginning of the code due to issues in WP 5.6 318 329 delete ym.map0.places; 319 330 ym.map0.places = {}; 320 331 321 // ym={map0: {center: coordaprox(yamap_defaults['center_map_option']), controls: yamap_defaults['controls_map_option'], height: yamap_defaults['height_map_option'], zoom: yamap_defaults['zoom_map_option'], maptype: yamap_defaults['type_map_option'], scrollzoom: optionCheck('wheelzoom_map_option'), mobiledrag: optionCheck('mobiledrag_map_option'), container: '', places: {}}};322 323 332 } 324 333 ymaps.ready(init); … … 326 335 }); 327 336 328 // Удаляем метку с карты337 // Remove the marker from the map 329 338 function removeplacemark(map, place) { 330 339 map.geoObjects.remove(place); 331 340 } 332 341 333 // Функция создания метки342 // Function to create a marker 334 343 function createplacemark(map, defcoord=[55.7532,37.6225]) { 335 344 var newmark=false; 336 enablefields(); // Активируем выключенные поля345 enablefields(); // Activate disabled fields 337 346 338 347 if (!ym.map0.places.hasOwnProperty('placemark'+markcount)) { 339 348 newmark=true; 340 349 ym.map0['places']['placemark'+markcount] = {name: '', coord: defcoord, icon: yamap_defaults['type_icon_option'], color: jQuery("#colorbox #colorbox-inp").val(), url: ''}; //: {name: 'placemark1', coord: coords, type: 'islands#blueDotIcon', color: '#ff0000', url: 'url1'}; 341 if (activeplace==='') { // Если создается первая метка, берем значения из полей формы350 if (activeplace==='') { // If the first marker is being created, take values from the form fields 342 351 activeplace = 'placemark'+markcount; 343 352 markchange(); … … 349 358 } 350 359 351 352 353 354 //Создание метки на карте 360 // Create a marker on the map 355 361 placemark[markcount] = new ymaps.Placemark(defcoord, { 356 362 hintContent: "name", … … 371 377 coords = defcoord; 372 378 373 374 375 //Отслеживаем событие перемещения метки 379 // Track the event of moving the marker 376 380 placemark[markcount].events.add("dragend", function (e) { 377 381 var trg = e.get('target'); … … 382 386 }, placemark[markcount]); 383 387 384 // Отслеживаем событие начала перемещения метки388 // Track the event of starting to move the marker 385 389 placemark[markcount].events.add("dragstart", function (e) { 386 390 var trg = e.get('target'); … … 396 400 397 401 398 // Добавляем событие клика по метке402 // Add click event to the marker 399 403 placemark[markcount].events.add('click', function (e) { 400 404 … … 405 409 enablefields(); 406 410 407 // Удаляем метку-закрытия для всех меток411 // Remove the closing marker for all markers 408 412 map.geoObjects.each(function (geoObject) { 409 413 if (geoObject.properties.get('id') == 'closesvg') { … … 413 417 }); 414 418 415 // Добавляем метку-кнопку закрытия родительской метки419 // Add a closing button marker for the parent marker 416 420 var closePlacemark = new ymaps.Placemark( 417 421 plcoord, … … 424 428 iconImageHref: url+ "/img/close.svg", 425 429 iconImageSize: [16, 16], 426 // Описываем фигуру активной области427 // " Прямоугольник".430 // Describe the shape of the active area 431 // "Rectangle". 428 432 iconOffset: [-2, -30], 429 433 iconImageOffset: [5, 10], … … 439 443 activeplace=''; 440 444 inactive(); 441 delete ym.map0['places'][trg.properties.get('id')]; // удаляем все свойства точки из массива445 delete ym.map0['places'][trg.properties.get('id')]; // remove all properties of the point from the array 442 446 if (Object.keys(ym.map0.places).length===0) { 443 // Выключаем поле с координатами447 // Disable the coordinates field 444 448 jQuery('#markercoord').val(yamap_object.NoCoord); 445 449 enablefields(false); … … 447 451 }); 448 452 449 // Событие клика для закрытия метки453 // Click event for closing the marker 450 454 map.events.add('click', function (e) { 451 455 removeplacemark(map, closePlacemark); … … 460 464 } 461 465 462 463 464 //Функция инициализации карты 466 // Function to initialize the map 465 467 function init () { 466 468 var myMap=[]; 467 469 var controlsArr=["zoomControl", "typeSelector"]; 468 if (apikeyexist) controlsArr.push("searchControl"); // Если определен API key, добавляем поиск на карту. Без ключа он все равно не будет работать и выдавать ошибку.470 if (apikeyexist) controlsArr.push("searchControl"); // If the API key is defined, add search to the map. Without a key, it won't work anyway and will throw an error. 469 471 470 472 mapcenter=ym.map0.center[0]; … … 480 482 }); 481 483 482 // Заполняем данные формы из массива при редактировании484 // Fill in the form data from the array when editing 483 485 function loadMap() { 484 486 if (ym.map0.height!=="undefined") jQuery('#mapheight').val(ym.map0.height); … … 487 489 } 488 490 489 490 491 //Ставим метки редактируемой карты 491 // Set markers for the edited map 492 492 function loadPlacemarks(map) { 493 493 … … 507 507 } 508 508 509 // Отслеживаем событие щелчка по карте509 // Track the event of clicking on the map 510 510 myMap[mapcount].events.add('click', function (e) { 511 511 createplacemark(myMap[mapcount], e.get('coords')); 512 512 }); 513 513 514 515 //Отслеживаем событие поиска и ставим метку в центр 514 // Track the event of searching and place a marker in the center 516 515 if (apikeyexist) { 517 516 var searchControl = myMap[mapcount].controls.get('searchControl'); … … 524 523 } 525 524 526 527 //Ослеживаем событие изменения области просмотра карты - масштаб и центр карты 525 // Track the event of changing the map view area - zoom and center of the map 528 526 myMap[mapcount].events.add('boundschange', function (event) { 529 527 if (event.get('newZoom') != event.get('oldZoom')) { … … 541 539 maptype = myMap[mapcount].getType(); 542 540 543 // Отслеживаем изменение типа карты541 // Track the change of the map type 544 542 myMap[mapcount].events.add('typechange', function (event) { 545 543 maptype = myMap[mapcount].getType(); … … 549 547 iconselectchange(); 550 548 551 552 549 jQuery("#mapheight, #mapcontrols").change(function() { 553 550 mapdatechange(); … … 557 554 }); 558 555 559 // отслеживаем изменение полей иконки556 // Track the change of icon fields 560 557 jQuery("#markername, #markercoord, #markericon-inp, #markerurl").change(function() { 561 558 markchange(); 562 559 }); 563 560 564 565 //отслеживаем изменение имени иконки 561 // Track the change of the icon name 566 562 jQuery("#markername").change(function() { 567 563 if (activeplace!=="") { … … 570 566 }); 571 567 572 573 //отслеживаем изменение типа иконки 568 // Track the change of the icon type 574 569 jQuery("#markericon-inp").change(function() { 575 570 iconselectchange(); … … 587 582 } 588 583 589 // Параметры модального окна редактора584 // Parameters of the editor modal window 590 585 function checkApiKeyForSearchField() { 591 586 if (apikeyexist) { … … 893 888 mapdatechange(); 894 889 mapSave(); 895 896 897 898 899 900 890 }); 901 891 … … 916 906 917 907 tinymce.PluginManager.add("yamap_plugin", tinymce.plugins.yamap_plugin); 918 919 920 921 908 })(); 922 -
yamaps/trunk/js/shortcode_parser.js
r2461407 r3235714 1 1 //Парсим шорткод меток внутри карты 2 2 function findPlaceMarks(found) { 3 if (typeof found !== 'string') return; 4 3 5 foundplace = found.match(/\[yaplacemark(.*?)\]/g); 4 if (foundplace!==null) { 5 for (var j = 0; j < foundplace.length; j++) { 6 foundplacemark=foundplace[j].match(/([a-zA-Z]+)="([^"]+)+"/gi); 7 ym['map0'].places['placemark'+j]={}; 8 for (var k = 0; k < foundplacemark.length; k++) { 6 if (foundplace !== null) { 7 for (var j = 0; j < foundplace.length; j++) { 8 foundplacemark = foundplace[j].match(/([a-zA-Z]+)="([^"]+)+"/gi); 9 ym['map0'].places['placemark'+j] = {}; 10 for (var k = 0; k < foundplacemark.length; k++) { 11 foundplacemark[k] = foundplacemark[k].split("&").join("&"); //Bugfix: Гутенберг меняет амперсанды на html тэги. Меняем обратно. 9 12 10 foundplacemark[k]=foundplacemark[k].split("&").join("&"); //Bugfix: Гутенберг меняет амперсанды на html тэги. Меняем обратно. 13 placeparams = foundplacemark[k].split("="); 14 if (placeparams.length > 2) { //Bugfix: Если строка в шорткоде содержит знак равества, не теряем ее продолжение при делении на ключ/значение 15 placeparams[1] = foundplacemark[k].replace(placeparams[0]+"=", ""); 16 } 17 placeparams[1] = placeparams[1].replace(/\"|\'/g, ''); 11 18 12 placeparams=foundplacemark[k].split("="); 13 if (placeparams.length>2) { //Bugfix: Если строка в шорткоде содержит знак равества, не теряем ее продолжение при делении на ключ/значение 14 placeparams[1]=foundplacemark[k].replace(placeparams[0]+"=", ""); 19 // Безопасная обработка URL и координат 20 if (placeparams[0] === 'coord') { 21 // Валидация координат 22 var coords = placeparams[1].split(','); 23 if (coords.length === 2) { 24 var lat = parseFloat(coords[0]); 25 var lng = parseFloat(coords[1]); 26 if (!isNaN(lat) && !isNaN(lng) && lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180) { 27 ym['map0'].places['placemark'+j][placeparams[0]] = lat + ',' + lng; 28 } else { 29 ym['map0'].places['placemark'+j][placeparams[0]] = '55.7473,37.6247'; // Дефолтные координаты 15 30 } 16 placeparams[1]=placeparams[1].replace(/\"|\'/g, ''); 17 if (placeparams[0]==='coord') { 18 ym['map0'].places['placemark'+j][placeparams[0]]=placeparams[1]; 31 } else { 32 ym['map0'].places['placemark'+j][placeparams[0]] = '55.7473,37.6247'; // Дефолтные координаты 33 } 34 } 35 else if (placeparams[0] === 'url') { 36 // Безопасная обработка URL 37 try { 38 var url = decodeURI(placeparams[1]); 39 // Проверяем, является ли значение числом (ID поста) 40 if (!isNaN(url)) { 41 ym['map0'].places['placemark'+j][placeparams[0]] = placeparams[1]; 42 } else { 43 // Если это URL, кодируем его 44 ym['map0'].places['placemark'+j][placeparams[0]] = encodeURI(url); 19 45 } 20 else { 21 ym['map0'].places['placemark'+j][placeparams[0]]=[placeparams[1]].join(''); 22 } 46 } catch(e) { 47 ym['map0'].places['placemark'+j][placeparams[0]] = ''; 23 48 } 49 } 50 else { 51 ym['map0'].places['placemark'+j][placeparams[0]] = placeparams[1]; 52 } 53 } 24 54 } 25 55 } -
yamaps/trunk/languages/yamaps.pot
r2849437 r3235714 4 4 "Project-Id-Version: YaMaps for Wordpress\n" 5 5 "Report-Msgid-Bugs-To: \n" 6 "POT-Creation-Date: 202 2-05-01 19:28+0000\n"6 "POT-Creation-Date: 2025-02-05 21:57+0000\n" 7 7 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 8 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 15 15 "X-Generator: Loco https://localise.biz/" 16 16 17 #: options.php:2 8217 #: options.php:291 18 18 msgid "" 19 19 "<a href=\"https://developer.tech.yandex.com/services/\">Get a key</a> " … … 21 21 msgstr "" 22 22 23 #: yamap.php:397 options.php:14723 #: options.php:154 includes/admin.php:42 24 24 msgid "" 25 25 "<div style=\"position: relative; display: block; width: 100%; white-space: " … … 47 47 msgstr "" 48 48 49 #: yamap.php:399 options.php:150 50 msgid "" 51 "<div style=\"position: relative; display: block; width: 100%; white-space: " 52 "normal !important;\"><h2 style=\"color: #444;font-size: 18px;font-weight: " 53 "600;line-height: 36px;\">Want other plugin features?</h2>Do you like the " 54 "plugin but lack features for your project? For commercial modifications of " 55 "the plugin, please contact me.</div><div style=\"position: relative; display:" 56 " block; width: 100%; white-space: normal !important;\"><h2 style=\"color: " 57 "#444;font-size: 18px;font-weight: 600;line-height: 36px;\">WordPress website " 58 "design and development</h2>My name is Yuri and I have been creating websites " 59 "for over 15 years. I have been familiar with WordPress since 2008. I know " 60 "and love this CMS for its user friendly interface. This is exactly how I " 61 "tried to make the interface of my YaMaps plugin, which you are currently " 62 "using. If you need to create a website, make an interface design or write a " 63 "plugin for WordPress - I will be happy to help you!<p style=\"margin-top: ." 64 "5rem; text-align: center;\"><b>Contacts:</b> <a href=\"mailto:mail@yhunter." 65 "ru\">[email protected]</a>, <b>telegram:</b> <a href=\"tg://resolve?" 66 "domain=yhunter\">@yhunter</a>, <b>tel:</b> <a href=\"tel:+79028358830\">+7-" 67 "902-83-588-30</a></p></div>" 68 msgstr "" 69 70 #: yamap.php:366 49 #: includes/admin.php:10 71 50 msgid "Add map" 72 51 msgstr "" 73 52 74 #: options.php:2 8553 #: options.php:294 75 54 msgid "API key" 76 55 msgstr "" 77 56 78 #: options.php:2 5257 #: options.php:261 79 58 msgid "Author link" 80 59 msgstr "" 81 60 82 #: options.php:2 4461 #: options.php:253 83 62 msgid "Big map" 84 63 msgstr "" 85 64 86 #: yamap.php:37265 #: includes/admin.php:16 87 66 msgid "Blue only" 88 67 msgstr "" 89 68 90 #: options.php: 19969 #: options.php:208 91 70 msgid "Choose default map type: yandex#map, yandex#satellite, yandex#hybrid" 92 71 msgstr "" 93 72 94 #: yamap.php:38073 #: includes/admin.php:24 95 74 msgid "Click on the map to choose or create the mark" 96 75 msgstr "" 97 76 98 #: yamap.php:38277 #: includes/admin.php:26 99 78 msgid "Delete" 100 79 msgstr "" 101 80 102 #: yamap.php:39881 #: includes/admin.php:41 103 82 msgid "Design & Development" 104 83 msgstr "" 105 84 106 #: options.php:25 085 #: options.php:259 107 86 msgid "Disable link to plugin page" 108 87 msgstr "" 109 88 110 #: yamap.php:39589 #: includes/admin.php:39 111 90 msgid "" 112 91 "Do not create a block in the content. Use the existing block of the WP theme " … … 114 93 msgstr "" 115 94 116 #: options.php:1 8195 #: options.php:190 117 96 msgid "Drag the map to set its default coordinates" 118 97 msgstr "" 119 98 120 #: yamap.php:36799 #: includes/admin.php:11 121 100 msgid "Edit map" 122 101 msgstr "" 123 102 124 #: yamap.php:396103 #: includes/admin.php:40 125 104 msgid "Extra" 126 105 msgstr "" 127 106 128 #: options.php:27 0107 #: options.php:279 129 108 msgid "For example:" 130 109 msgstr "" 131 110 132 #: yamap.php:391 options.php:218111 #: options.php:227 includes/admin.php:35 133 112 msgid "Full screen" 134 113 msgstr "" 135 114 136 #: yamap.php:392 options.php:218115 #: options.php:227 includes/admin.php:36 137 116 msgid "Geolocation" 138 117 msgstr "" 139 118 140 #: yamap.php:371 options.php:264119 #: options.php:273 includes/admin.php:15 141 120 msgid "Icon" 142 121 msgstr "" 143 122 144 #: yamap.php:373123 #: includes/admin.php:17 145 124 msgid "Link" 146 125 msgstr "" 147 126 148 #: yamap.php:365 yamap.php:370127 #: includes/admin.php:9 includes/admin.php:14 149 128 msgid "Map" 150 129 msgstr "" 151 130 131 #: options.php:193 132 msgid "Map center" 133 msgstr "" 134 135 #: options.php:229 includes/admin.php:25 136 msgid "Map controls" 137 msgstr "" 138 139 #: options.php:220 includes/admin.php:19 140 msgid "Map height" 141 msgstr "" 142 152 143 #: options.php:184 153 msgid "Map center"154 msgstr ""155 156 #: yamap.php:381 options.php:220157 msgid "Map controls"158 msgstr ""159 160 #: yamap.php:375 options.php:211161 msgid "Map height"162 msgstr ""163 164 #: options.php:175165 144 msgid "Map options" 166 145 msgstr "" 167 146 168 #: yamap.php:383 options.php:202 options.php:218147 #: options.php:211 options.php:227 includes/admin.php:27 169 148 msgid "Map type" 170 149 msgstr "" 171 150 172 #: options.php: 193151 #: options.php:202 173 152 msgid "Map zoom" 174 153 msgstr "" 175 154 176 #: yamap.php:393 options.php:272155 #: options.php:281 includes/admin.php:37 177 156 msgid "Marker color" 178 157 msgstr "" 179 158 180 #: options.php:2 56159 #: options.php:265 181 160 msgid "Marker options" 182 161 msgstr "" 183 162 184 #: yamap.php:386 options.php:236163 #: options.php:245 includes/admin.php:30 185 164 msgid "Mobile drag" 186 165 msgstr "" 187 166 188 #: options.php:2 42167 #: options.php:251 189 168 msgid "Open big map/how to get button" 190 169 msgstr "" 191 170 192 #: options.php:2 62171 #: options.php:271 193 172 msgid "Other icon types" 194 173 msgstr "" 195 174 196 #: yamap.php:369175 #: includes/admin.php:13 197 176 msgid "Placemark" 198 177 msgstr "" 199 178 200 #: yamap.php:374179 #: includes/admin.php:18 201 180 msgid "Placemark hyperlink url or post ID" 202 181 msgstr "" 203 182 204 #: yamap.php:376183 #: includes/admin.php:20 205 184 msgid "Placemark name" 206 185 msgstr "" 207 186 208 #: yamap.php:394187 #: includes/admin.php:38 209 188 msgid "Put in ID" 210 189 msgstr "" 211 190 212 #: options.php:2 89 options.php:297191 #: options.php:298 options.php:306 213 192 msgid "Reset options" 214 193 msgstr "" 215 194 216 #: options.php: 295195 #: options.php:304 217 196 msgid "Restore defaults" 218 197 msgstr "" 219 198 220 #: yamap.php:388 options.php:218199 #: options.php:227 includes/admin.php:32 221 200 msgid "Route" 222 201 msgstr "" 223 202 224 #: yamap.php:389 options.php:218203 #: options.php:227 includes/admin.php:33 225 204 msgid "Ruler" 226 205 msgstr "" 227 206 228 #: yamap.php:387 options.php:218207 #: options.php:227 includes/admin.php:31 229 208 msgid "Search" 230 209 msgstr "" 231 210 232 #: yamap.php:377 211 #: options.php:382 212 msgid "Security check failed" 213 msgstr "" 214 215 #: includes/admin.php:21 233 216 msgid "Text for hint or icon content" 234 217 msgstr "" 235 218 236 #: options.php:2 34219 #: options.php:243 237 220 msgid "The map can be dragged on mobile" 238 221 msgstr "" 239 222 240 #: options.php:2 26223 #: options.php:235 241 224 msgid "The map can be scaled with mouse scroll" 242 225 msgstr "" 243 226 244 #: yamap.php:390 options.php:218227 #: options.php:227 includes/admin.php:34 245 228 msgid "Traffic" 246 229 msgstr "" 247 230 248 #: yamap.php:378231 #: includes/admin.php:22 249 232 msgid "Use the links below" 250 233 msgstr "" 251 234 252 #: yamap.php:385 options.php:228235 #: options.php:237 includes/admin.php:29 253 236 msgid "Wheel zoom" 254 237 msgstr "" … … 262 245 msgstr "" 263 246 264 #: options.php: 39247 #: options.php:44 265 248 msgid "YaMaps default options" 266 249 msgstr "" … … 270 253 msgstr "" 271 254 272 #: yamap.php:330255 #: includes/shortcodes.php:207 273 256 msgid "YaMaps plugin for Wordpress" 274 257 msgstr "" 275 258 276 #: yamap.php:368259 #: includes/admin.php:12 277 260 msgid "YaMaps plugin: Yandex.Map" 278 261 msgstr "" … … 282 265 msgstr "" 283 266 284 #: options.php:2 76267 #: options.php:285 285 268 msgid "Yandex.Maps API key" 269 msgstr "" 270 271 #: options.php:31 272 msgid "You do not have sufficient permissions to access this page." 286 273 msgstr "" 287 274 … … 290 277 msgstr "" 291 278 292 #: yamap.php:384 options.php:218279 #: options.php:227 includes/admin.php:28 293 280 msgid "Zoom" 294 281 msgstr "" 295 282 296 #: options.php:19 0283 #: options.php:199 297 284 msgid "Zoom the map to set its default scale" 298 285 msgstr "" 299 286 300 #: yamap.php:379287 #: includes/admin.php:23 301 288 msgid "Сoordinates" 302 289 msgstr "" -
yamaps/trunk/options.php
r3207180 r3235714 2 2 $yamaps_page = 'yamaps-options.php'; 3 3 4 global $yamaps_page, $yamaps_defaults, $yamaps_defaults_front_bak ;4 global $yamaps_page, $yamaps_defaults, $yamaps_defaults_front_bak, $lang_array; 5 5 $option_name = 'yamaps_options'; 6 6 if(get_option($option_name)){ … … 15 15 16 16 /* 17 * Функция, добавляющая страницу в пункт меню Настройки17 * Function to add a page to the Settings menu 18 18 */ 19 19 function yamaps_options() { … … 24 24 25 25 /** 26 * Возвратная функция (Callback)26 * Callback function 27 27 */ 28 28 function yamaps_option_page(){ 29 // Check user permissions 30 if (!current_user_can('manage_options')) { 31 wp_die(__('You do not have sufficient permissions to access this page.', 'yamaps')); 32 } 33 29 34 global $yamaps_page, $yamaps_defaults; 30 35 $maplocale = get_locale(); 31 36 if (strlen($maplocale)<5) $maplocale = "en_US"; 32 37 if (trim($yamaps_defaults['apikey_map_option'])<>"") { 33 $apikey='&apikey='. $yamaps_defaults['apikey_map_option'];38 $apikey='&apikey='.esc_attr($yamaps_defaults['apikey_map_option']); 34 39 } 35 40 else { … … 37 42 } 38 43 ?><div class="wrap"> 39 <h2><?php echo __( 'YaMaps default options', 'yamaps'); ?></h2>44 <h2><?php echo esc_html__('YaMaps default options', 'yamaps'); ?></h2> 40 45 <form method="post" id="YaMapsOptions" enctype="multipart/form-data" action="options.php"> 41 <?php echo'<script src="https://api-maps.yandex.ru/2.1/?lang='.$maplocale.$apikey.'" type="text/javascript"></script>'; ?> 46 <?php 47 wp_nonce_field('yamaps_options_verify', 'yamaps_options_nonce'); 48 echo '<script src="https://api-maps.yandex.ru/2.1/?lang='.esc_attr($maplocale).esc_attr($apikey).'" type="text/javascript"></script>'; ?> 42 49 <script type="text/javascript"> 43 // Округляем координаты до 4 знаков после запятой50 // Round coordinates to 4 decimal places 44 51 function coordaprox(fullcoord) { 45 52 if (fullcoord.length!==2) { … … 55 62 56 63 57 // Инициализируем карту для страницы настроек64 // Initialize the map for the settings page 58 65 function init () { 59 66 var testvar=document.getElementById('center_map_option').value; … … 61 68 if (apikey!=="") apikeyexist=true; 62 69 var controlsArr=["zoomControl", "typeSelector"]; 63 if (apikeyexist) controlsArr.push("searchControl"); // Если определен API key, добавляем поиск на карту. Без ключа он все равно не будет работать и выдавать ошибку.70 if (apikeyexist) controlsArr.push("searchControl"); // If the API key is defined, add search to the map. Without a key, it won't work anyway and will throw an error. 64 71 65 72 var myMap0 = new ymaps.Map("yamap", { … … 70 77 }); 71 78 72 // Добавляем пример метки79 // Add a sample placemark 73 80 placemark1 = new ymaps.Placemark([<?php echo $yamaps_defaults["center_map_option"]; ?>], { 74 81 hintContent: "Placemark", … … 78 85 }, { 79 86 <?php 80 // Проверяем, является ли поле иконки url-адресом. Если да, то ставим в качестве иконки кастомное изображение.87 // Check if the icon field is a URL. If yes, set a custom image as the icon. 81 88 $iconurl = strripos($yamaps_defaults["type_icon_option"], 'http'); 82 89 if (is_int($iconurl)) { … … 101 108 myMap0.geoObjects.add(placemark1); 102 109 103 // Событие перемещения карты110 // Map movement event 104 111 myMap0.events.add('boundschange', function (event) { 105 // Если изменили масштаб112 // If the zoom level changed 106 113 if (event.get('newZoom') != event.get('oldZoom')) { 107 114 document.getElementById('zoom_map_option').value = event.get('newZoom'); 108 115 } 109 // Если переместили центр116 // If the center was moved 110 117 if (event.get('newCenter') != event.get('oldCenter')) { 111 118 document.getElementById('center_map_option').value = coordaprox(event.get('newCenter')); 112 119 } 113 // Помещаем метку в новый центр120 // Place the marker in the new center 114 121 placemark1.geometry.setCoordinates(event.get('newCenter')); 115 122 }); 116 // Событие смены иконки123 // Icon change event 117 124 myMap0.events.add('typechange', function (event) { 118 125 document.getElementById('type_map_option').value = myMap0.getType(); 119 126 }); 120 // Cобытие поиска, скрываем метку результата121 if (apikeyexist) { // Баг, если нет API.ключа, то нет поискового поля и вызывает ошибку127 // Search event, hide the result marker 128 if (apikeyexist) { // Bug, if there is no API key, then there is no search field and it throws an error 122 129 var searchControl = myMap0.controls.get('searchControl'); 123 130 searchControl.events.add('resultshow', function (e) { … … 125 132 }); 126 133 } 127 // Функция добавления элементов управления картой в поле настроек134 // Function to add map control elements in the settings field 128 135 var controlElems = document.querySelectorAll('#addcontrol a'); 129 136 for (var i = 0; i < controlElems.length; i++) { … … 154 161 </div> 155 162 <?php 156 settings_fields('yamaps_options'); // Идентификатор настроек плагина163 settings_fields('yamaps_options'); // Plugin settings identifier 157 164 do_settings_sections($yamaps_page); 158 165 ?> … … 166 173 167 174 /* 168 * Регистрируем настройки169 * Мои настройки будут храниться в базе под названием yamaps_options (это также видно в предыдущей функции)175 * Register settings 176 * My settings will be stored in the database under the name yamaps_options (this is also visible in the previous function) 170 177 */ 171 178 function yamaps_option_settings() { 172 179 global $yamaps_page; 173 // Присваиваем функцию валидации ( yamaps_validate_settings() ). Вы найдете её ниже180 // Assign validation function ( yamaps_validate_settings() ). You will find it below 174 181 register_setting( 'yamaps_options', 'yamaps_options', 'yamaps_validate_settings' ); // yamaps_options 175 182 176 // Область настроек карты183 // Map settings area 177 184 add_settings_section( 'map_section', __( 'Map options', 'yamaps' ), '', $yamaps_page ); 178 185 179 // Поле центра карты180 $yamaps_field_params = array( 181 'type' => 'text', // тип186 // Map center field 187 $yamaps_field_params = array( 188 'type' => 'text', // type 182 189 'id' => 'center_map_option', 183 190 'desc' => __( 'Drag the map to set its default coordinates', 'yamaps' ), … … 186 193 add_settings_field( 'center_map_option', __( 'Map center', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'map_section', $yamaps_field_params ); 187 194 188 // Поле масштаба карты189 $yamaps_field_params = array( 190 'type' => 'text', // тип195 // Map zoom field 196 $yamaps_field_params = array( 197 'type' => 'text', // type 191 198 'id' => 'zoom_map_option', 192 199 'desc' => __( 'Zoom the map to set its default scale', 'yamaps' ), … … 195 202 add_settings_field( 'zoom_map_option', __( 'Map zoom', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'map_section', $yamaps_field_params ); 196 203 197 // Поле типа карты198 $yamaps_field_params = array( 199 'type' => 'text', // тип204 // Map type field 205 $yamaps_field_params = array( 206 'type' => 'text', // type 200 207 'id' => 'type_map_option', 201 208 'desc' => __( 'Choose default map type: yandex#map, yandex#satellite, yandex#hybrid', 'yamaps' ), … … 204 211 add_settings_field( 'type_map_option', __( 'Map type', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'map_section', $yamaps_field_params ); 205 212 206 // Поле высоты карты207 $yamaps_field_params = array( 208 'type' => 'text', // тип213 // Map height field 214 $yamaps_field_params = array( 215 'type' => 'text', // type 209 216 'id' => 'height_map_option', 210 217 'desc' => 'rem, em, px, %', … … 214 221 215 222 216 // Поле элементов управления карты223 // Map controls field 217 224 $yamaps_field_params = array( 218 225 'type' => 'textarea', … … 222 229 add_settings_field( 'controls_map_option', __( 'Map controls', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'map_section', $yamaps_field_params ); 223 230 224 // Чекбокс масштаба колесом231 // Checkbox for wheel zoom 225 232 $yamaps_field_params = array( 226 233 'type' => 'checkbox', … … 230 237 add_settings_field( 'wheelzoom_map_option', __( 'Wheel zoom', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'map_section', $yamaps_field_params ); 231 238 232 // Чекбокс мобильного перетаскивания239 // Checkbox for mobile dragging 233 240 $yamaps_field_params = array( 234 241 'type' => 'checkbox', … … 238 245 add_settings_field( 'mobiledrag_map_option', __( 'Mobile drag', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'map_section', $yamaps_field_params ); 239 246 240 // Чекбокс открытия большой карты247 // Checkbox for opening a big map 241 248 $yamaps_field_params = array( 242 249 'type' => 'checkbox', … … 246 253 add_settings_field( 'open_map_option', __( 'Big map', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'map_section', $yamaps_field_params ); 247 254 248 // Чекбокс ссылки на автора255 // Checkbox for author link 249 256 $yamaps_field_params = array( 250 257 'type' => 'checkbox', … … 254 261 add_settings_field( 'authorlink_map_option', __( 'Author link', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'map_section', $yamaps_field_params ); 255 262 256 // Область настроек метки263 // Marker settings area 257 264 258 265 add_settings_section( 'icon_section', __( 'Marker options', 'yamaps' ), '', $yamaps_page ); 259 266 260 // Поле типа метки267 // Marker type field 261 268 $yamaps_field_params = array( 262 269 'type' => 'text', … … 266 273 add_settings_field( 'type_icon_option', __( 'Icon', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'icon_section', $yamaps_field_params ); 267 274 268 // Поле цвета метки275 // Marker color field 269 276 $yamaps_field_params = array( 270 277 'type' => 'text', … … 274 281 add_settings_field( 'color_icon_option', __( 'Marker color', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'icon_section', $yamaps_field_params ); 275 282 276 // Область ключа API283 // API key area 277 284 278 285 add_settings_section( 'apikey_section', __( 'Yandex.Maps API key', 'yamaps' ), '', $yamaps_page ); 279 286 280 // Поле ключа API281 $yamaps_field_params = array( 282 'type' => 'text', // тип287 // API key field 288 $yamaps_field_params = array( 289 'type' => 'text', // type 283 290 'id' => 'apikey_map_option', 284 291 'desc' => __( '<a href="https://developer.tech.yandex.com/services/">Get a key</a> (JavaScript API & HTTP Geocoder) if it necessary', 'yamaps' ), … … 287 294 add_settings_field( 'apikey_map_option', __( 'API key', 'yamaps' ), 'yamaps_option_display_settings', $yamaps_page, 'apikey_section', $yamaps_field_params ); 288 295 289 // Область сброса настроек296 // Reset settings area 290 297 291 298 add_settings_section( 'reset_section', __( 'Reset options', 'yamaps' ), '', $yamaps_page ); 292 299 293 // Чекбокс сброса настроек300 // Reset settings checkbox 294 301 $yamaps_field_params = array( 295 302 'type' => 'checkbox', … … 303 310 304 311 /* 305 * Функция отображения полей ввода306 * Здесь задаётся HTML и PHP, выводящий поля312 * Function to display input fields 313 * Here is the HTML and PHP that outputs the fields 307 314 */ 308 315 function yamaps_option_display_settings($args) { … … 311 318 312 319 $option_name = 'yamaps_options'; 313 //delete_option($option_name); // удаление настроек для тестов320 //delete_option($option_name); // delete settings for testing 314 321 315 // Если настройки не найдены в БД, сохраняем туда дефолтные настройки плагина322 // If settings are not found in the database, save the default settings of the plugin there 316 323 if(!get_option( $option_name)){ 317 324 update_option( $option_name, $yamaps_defaults_front_bak); 318 325 } 319 326 320 // Нужно перебрать настройки и поставить дефолт в отсутствующие.327 // Need to iterate through the settings and set the default for the missing ones. 321 328 322 329 $o = get_option( $option_name ); … … 367 374 } 368 375 376 /* 377 * Data validation function 378 */ 379 function yamaps_validate_settings($input) { 380 // Check nonce 381 if (!isset($_POST['yamaps_options_nonce']) || !wp_verify_nonce($_POST['yamaps_options_nonce'], 'yamaps_options_verify')) { 382 add_settings_error('yamaps_options', 'invalid_nonce', __('Security check failed', 'yamaps')); 383 return get_option('yamaps_options'); 384 } 385 386 return $input; 387 } 388 369 389 ?> -
yamaps/trunk/readme.txt
r3207180 r3235714 102 102 == Changelog == 103 103 104 = 0.6.30 = 105 * Security improvements. 106 * Code refactoring. 107 * Fixed: Bugfix. 108 104 109 = 0.6.28 = 105 110 * Fixed: Bugfix. -
yamaps/trunk/style.content.css
r1917981 r3235714 1 .yamap_shortcode {2 clear:both;3 padding: .0rem 1rem 1rem 1rem;4 border: 1px #ccc dashed;5 overflow: hidden;6 display: block;7 }8 9 .yamap_shortcode .content{10 margin: 1px 0 0 0px;11 display: inline-block;12 float: left;13 padding: 0;14 15 }16 17 .yamap_title {18 font-size: .8em;19 color: #666;20 margin-bottom: .5em;21 border-bottom: 1px #ccc dashed;22 padding: .5em 0;23 }24 25 .yamap_icon {26 display: inline-block;27 position: relative;28 width: 1.2em;29 height: 1.2em;30 background-image: url('js/img/placeholder.svg');31 background-repeat: no-repeat;32 opacity: .7;33 }34 35 36 .mce-container ymaps {37 font-family: "Source Sans Pro",HelveticaNeue-Light,"Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif !important;38 font-size: 12px !important;39 } -
yamaps/trunk/templates/tmpl-editor-yamap.html
r1917981 r3235714 1 1 <script type="text/html" id="tmpl-editor-yamap"> 2 <style> 3 .yamap_shortcode { 4 clear: both; 5 padding: .0rem 1rem 1rem 1rem; 6 border: 1px #ccc dashed; 7 overflow: hidden; 8 display: block; 9 } 10 11 .yamap_shortcode .content { 12 margin: 1px 0 0 0px; 13 display: inline-block; 14 float: left; 15 padding: 0; 16 17 } 18 19 .yamap_title { 20 font-size: .8em; 21 color: #666; 22 margin-bottom: .5em; 23 border-bottom: 1px #ccc dashed; 24 padding: .5em 0; 25 } 26 27 .yamap_icon { 28 display: inline-block; 29 position: relative; 30 width: 1.2em; 31 height: 1.2em; 32 background-image: url('js/img/placeholder.svg'); 33 background-repeat: no-repeat; 34 opacity: .7; 35 } 36 37 38 .mce-container ymaps { 39 font-family: "Source Sans Pro", HelveticaNeue-Light, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif !important; 40 font-size: 12px !important; 41 } 42 </style> 2 43 <div class="yamap_shortcode"> 3 44 <div class="yamap_title"><span class="yamap_icon"></span> {{ data.plugin }} </div> -
yamaps/trunk/yamap.php
r3207180 r3235714 6 6 * Author URI: www.yhunter.ru 7 7 * Author: Yuri Baranov 8 * Version: 0.6. 288 * Version: 0.6.30 9 9 * 10 10 * … … 15 15 * 16 16 */ 17 global $maps_count, $count_content, $yamap_load_api;18 17 19 if (!isset($maps_count)) { 20 $maps_count=0; 18 $lang_array = array(); 19 20 // Load components 21 require_once plugin_dir_path(__FILE__) . 'includes/init.php'; 22 require_once plugin_dir_path(__FILE__) . 'includes/shortcodes.php'; 23 require_once plugin_dir_path(__FILE__) . 'includes/api.php'; 24 require_once plugin_dir_path(__FILE__) . 'includes/admin.php'; 25 26 // Load text domain for localization 27 function yamaps_plugin_load_plugin_textdomain() { 28 load_plugin_textdomain('yamaps', FALSE, basename(dirname(__FILE__)) . '/languages/'); 21 29 } 22 if (!isset($count_content)) { 23 $count_content=0; 24 } 30 add_action('plugins_loaded', 'yamaps_plugin_load_plugin_textdomain'); 25 31 26 // Test for the first time content and single map (WooCommerce and other custom posts) 27 //$count_content=0; 28 $yamap_load_api=true; 29 $apikey=''; 30 31 $yamaps_defaults_front = array( 32 'center_map_option' => '55.7473,37.6247', 33 'zoom_map_option' => '12', 34 'type_map_option' => 'yandex#map', 35 'height_map_option' => '22rem', 36 'controls_map_option' => '', 37 'wheelzoom_map_option' => 'off', 38 'mobiledrag_map_option' => 'off', 39 'type_icon_option' => 'islands#dotIcon', 40 'color_icon_option' => '#1e98ff', 41 'authorlink_map_option' => 'off', 42 'open_map_option' => 'off', 43 'apikey_map_option' => '', 44 'reset_maps_option' => 'off', 45 ); 46 47 $yamaps_defaults_front_bak=$yamaps_defaults_front; 48 $yamaps_defaults=$yamaps_defaults_front; 49 50 //Загрузка настроек 51 52 $option_name = 'yamaps_options'; 53 if(get_option($option_name)){ 54 $yamaps_defaults_front=get_option($option_name); 55 //исправляем ошибку с дефолтными настройками 0.5.7 56 $fixpos = strripos($yamaps_defaults_front['controls_map_option'], '111'); 57 if (is_int($fixpos)) { 58 $fixpattern=array('111;','111'); 59 $yamaps_defaults_front['controls_map_option']=str_replace($fixpattern, '', $yamaps_defaults_front['controls_map_option']); 60 echo esc_html($yamaps_defaults_front['controls_map_option']); 61 update_option($option_name, $yamaps_defaults_front); 62 } 63 //конец правки. Будет удалено в следующих версиях. 64 } 65 66 //Проверяем все ли дефолтные параметры есть в настройках плагина 67 foreach($yamaps_defaults_front_bak as $yamaps_options_key => $yamaps_options_val) { 68 if(!isset($yamaps_defaults_front[$yamaps_options_key])) { 69 $yamaps_defaults_front[$yamaps_options_key]=$yamaps_defaults_front_bak[$yamaps_options_key]; 70 } 71 } 72 73 //Добавляем счетчик полей с контентом (для постов с произвольными полями) 74 add_filter( 'the_content', 'yamaps_the_content'); 75 add_filter('widget_text', 'yamaps_the_content'); 76 add_filter('requirement', 'yamaps_the_content'); 77 78 function yamaps_the_content( $content ) { 79 global $count_content; 80 $count_content++; 81 return $content; 82 } 83 84 //Новый вызов Yandex Map API. Если передаем true, отдается только адрес API с локалью и API-ключем. Нужно для альтернативного подключения API, при отсутствии wp_footer 85 function YandexMapAPI_script($noFooter = false) { 86 global $yamaps_defaults_front, $apikey, $post; 87 $maplocale = get_locale(); 88 if (strlen($maplocale)<5) $maplocale = "en_US"; 89 if (trim($yamaps_defaults_front['apikey_map_option'])<>"") { 90 $apikey='&apikey='.esc_html($yamaps_defaults_front['apikey_map_option']); 91 } 92 else { 93 $apikey = ''; 94 } 95 if ($noFooter) { 96 $AltApiSrc = 'https://api-maps.yandex.ru/2.1/?lang='.esc_html($maplocale).esc_html($apikey).'&ver=2.1'; 97 $AltApiSrc = str_replace("&", "&", $AltApiSrc); 98 return $AltApiSrc; 99 } 100 else { 101 if ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'yamap') ) { 102 // Register the script like this for a plugin: 103 wp_register_script( 'YandexMapAPI', 'https://api-maps.yandex.ru/2.1/?lang='.esc_html($maplocale).esc_html($apikey), [], 2.1, true ); 104 105 // For either a plugin or a theme, you can then enqueue the script: 106 wp_enqueue_script( 'YandexMapAPI' ); 107 } 108 } 109 110 } 111 112 //Функция добавления метки на карту 113 function yaplacemark_func($atts) { 114 $atts = shortcode_atts( array( 115 'coord' => '', 116 'name' => '', 117 'color' => 'blue', 118 'url' => '', 119 'icon' => 'islands#dotIcon', 120 ), $atts ); 121 122 global $yaplacemark_count, $maps_count; 123 $yaplacemark_count++; 124 $yahint=""; 125 $yacontent=""; 126 $yaicon=trim(esc_html($atts["icon"])); 127 128 129 if (strstr($yaicon, "Stretchy")<>FALSE) { 130 $yahint=""; 131 $yacontent=sanitize_text_field($atts["name"]); 132 } 133 else { 134 if (($yaicon==="islands#blueIcon")or($yaicon==="islands#blueCircleIcon")) { 135 $yahint=esc_html($atts["name"]); 136 $yacontent=esc_html(mb_substr($yahint, 0, 1)); 137 } 138 else { 139 $yahint=esc_html($atts["name"]); 140 $yacontent=""; 141 } 142 } 143 144 145 $yaplacemark=' 146 YaMapsWP.myMap'.$maps_count.'.places.placemark'.$yaplacemark_count.' = {icon: "'.esc_js($atts["icon"]).'", name: "'.esc_js($atts["name"]).'", color: "'.esc_js($atts["color"]).'", coord: "'.esc_js($atts["coord"]).'", url: "'.esc_url($atts["url"]).'",}; 147 myMap'.$maps_count.'placemark'.$yaplacemark_count.' = new ymaps.Placemark(['.$atts["coord"].'], { 148 hintContent: "'.esc_js($yahint).'", 149 iconContent: "'.esc_js($yacontent).'", 150 151 152 153 }, {'; 154 //Проверяем, является ли поле иконки url-адресом. Если да, то ставим в качестве иконки кастомное изображение. 155 $iconurl = strripos($atts["icon"], 'http'); 156 if (is_int($iconurl)) { 157 $yaplacemark.=' 158 iconLayout: "default#image", 159 iconImageHref: "'.esc_js($atts["icon"]).'" 160 }); 161 '; 162 163 } 164 else { 165 $yaplacemark.=' 166 preset: "'.esc_js($atts["icon"]).'", 167 iconColor: "'.esc_js($atts["color"]).'", 168 }); 169 '; 170 } 171 172 $atts["url"]=trim(esc_js($atts["url"])); 173 if (($atts["url"]<>"")and($atts["url"]<>"0")) { 174 $marklink=$atts["url"]; 175 settype($marklink, "integer"); 176 if ($marklink<>0) { 177 $marklink=get_the_permalink(esc_js($atts["url"])); 178 $yaplacemark.='YaMapsWP.myMap'.$maps_count.'.places["placemark'.$yaplacemark_count.'"].url="'.$marklink.'"'; 179 } 180 else { 181 $marklink=$atts["url"]; 182 } 183 $yaplacemark.=' 184 YMlisteners.myMap'.$maps_count.'['.$yaplacemark_count.'] = myMap'.$maps_count.'placemark'.$yaplacemark_count.'.events.group().add("click", function(e) {yamapsonclick("'.esc_url($marklink).'")}); 185 186 '; 187 } 188 return $yaplacemark; 189 } 190 191 //Функция вывода карты 192 function yamap_func($atts, $content){ 193 global $yaplacemark_count, $yamaps_defaults_front, $yamaps_defaults_front_bak, $yacontrol_count, $maps_count, $count_content, $yamap_load_api, $suppressMapOpenBlock, $yamap_onpage; 194 195 $placearr = ''; 196 $atts = shortcode_atts( array( 197 'center' => esc_js($yamaps_defaults_front['center_map_option']), 198 'zoom' => esc_js($yamaps_defaults_front['zoom_map_option']), 199 'type' => 'map', 200 'height' => esc_js($yamaps_defaults_front['height_map_option']), 201 'controls' => esc_js($yamaps_defaults_front['controls_map_option']), 202 'scrollzoom' => '1', 203 'mobiledrag' => '1', 204 'container' => '', 205 206 ), $atts ); 207 208 $yaplacemark_count=0; 209 $yacontrol_count=0; 210 $yamap_onpage=true; 211 212 $yamactrl=str_replace(';', '", "', esc_js($atts["controls"])); 213 214 if (trim($yamactrl)<>"") $yamactrl='"'.$yamactrl.'"'; 215 216 if (($yamap_load_api)) { // First time content and single map 217 if (trim($yamaps_defaults_front['apikey_map_option'])<>"") { 218 $apikey='&apikey='.esc_js($yamaps_defaults_front['apikey_map_option']); 219 } 220 else { 221 $apikey = ''; 222 } 223 224 $yamap=' 225 <script> 226 if (typeof(YaMapsWP) === "undefined") { 227 var YaMapsWP = {}, YMlisteners = {}; 228 var YaMapsScript = document.createElement("script"); 229 var YaMapsScriptCounter = []; 230 } 231 var myMap'.$maps_count.'; 232 </script>'; 233 } 234 else { 235 $yamap=''; 236 } 237 238 $placemarkscode=str_replace(" ", "", strip_tags($content)); 239 240 $atts["container"]=trim($atts["container"]); 241 if ($atts["container"]<>"") { 242 $mapcontainter=esc_html($atts["container"]); 243 $mapcontainter=str_replace("#", "", $mapcontainter); 244 } 245 else { 246 $mapcontainter='yamap'.$maps_count; 247 } 248 249 // Проверяем опцию включения кнопки большой карты 250 if ($yamaps_defaults_front['open_map_option']<>'on') { 251 $suppressMapOpenBlock='true'; 252 } 253 else { 254 $suppressMapOpenBlock='false'; 255 } 256 //1. Дожидаемся загрузки всей страницы для инициализации карты 257 //2. Проверяем, подключился ли API в wp_footer по ID "YandexMapAPI-js" (wp_footer может не оказаться в кастомных шаблонах) 258 //3. Если нет, запускаем функцию альтернативного подключения API - AltApiLoad, подключаем скрипт с ID "YandexMapAPI-alt-js" 259 //4. Функцию инициализации каждой карты на странице записываем в массив YaMapsScriptCounter и, после загрузки скрипта, поочередно инициализируем 260 $yamap.=' 261 <script type="text/javascript"> 262 document.addEventListener("DOMContentLoaded", function() { 263 if (document.getElementById("YandexMapAPI-js") == null ) { 264 YaMapsScriptCounter.push(function() {ymaps.ready(init)}); 265 if (document.getElementById("YandexMapAPI-alt-js") == null ) { 266 function AltApiLoad(src){ 267 268 YaMapsScript.id = "YandexMapAPI-alt-js"; 269 YaMapsScript.src = src; 270 YaMapsScript.async = false; 271 document.head.appendChild(YaMapsScript); 272 273 } 274 275 AltApiLoad("'.YandexMapAPI_script(true).'"); 276 277 window.onload = function() { 278 YaMapsScriptCounter.forEach(function(entryFunc) { 279 entryFunc(); 280 }); 281 } 282 } 283 284 285 286 } 287 else { 288 ymaps.ready(init); 289 } 290 291 292 YMlisteners.myMap'.$maps_count.' = {}; 293 YaMapsWP.myMap'.$maps_count.' = {center: "'.esc_js($atts["center"]).'", zoom: "'.esc_js($atts["zoom"]).'", type: "'.esc_js($atts["type"]).'", controls: "'.esc_js($atts["controls"]).'", places: {}}; 294 295 var yamapsonclick = function (url) { 296 location.href=url; 297 } 298 299 function init () { 300 myMap'.$maps_count.' = new ymaps.Map("'.$mapcontainter.'", { 301 center: ['.sanitize_text_field($atts["center"]).'], 302 zoom: '.sanitize_text_field($atts["zoom"]).', 303 type: "'.sanitize_text_field($atts["type"]).'", 304 controls: ['.sanitize_text_field($yamactrl).'] , 305 306 }, 307 { 308 suppressMapOpenBlock: '.esc_js($suppressMapOpenBlock).' 309 }); 310 311 '.do_shortcode($placemarkscode); 312 313 for ($i = 1; $i <= $yaplacemark_count; $i++) { 314 $placearr.='.add(myMap'.$maps_count.'placemark'.$i.')'; 315 } 316 $yamap.='myMap'.$maps_count.'.geoObjects'.$placearr.';'; 317 if ($atts["scrollzoom"]=="0") $yamap.="myMap".$maps_count.".behaviors.disable('scrollZoom');"; 318 //Если у карты mobiledrag=0, отключаем прокрутку карты для следующих платформ 319 if ($atts["mobiledrag"]=="0") { 320 $yamap.=" 321 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) { 322 myMap".$maps_count.".behaviors.disable('drag'); 323 }"; 324 } 325 $yamap.=' 326 327 } 328 }, false); 329 </script> 330 331 '; 332 $authorLinkTitle=__( 'YaMaps plugin for Wordpress', 'yamaps' ); 333 334 if($yamaps_defaults_front['authorlink_map_option']<>'on'){ 335 336 $authorlink='<div style="position: relative; height: 0; margin-bottom: 1rem !important; margin-top:0 !important; overflow: visible; width: 100%; text-align: center; top: -32px;"><a href="https://www.yhunter.ru/portfolio/dev/yamaps/" title="'.esc_attr($authorLinkTitle).'" target="_blank" style="display: inline-block; -webkit-box-align: center; padding: 3.5px 5px; text-decoration: none !important; border-bottom: 0; border-radius: 3px; background-color: #fff; cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px 1px rgba(0,0,0,.15),0 2px 5px -3px rgba(0,0,0,.15);"><img src="'.plugins_url( 'js/img/placeholder.svg' , __FILE__ ).'" alt="" style="width: 17px; height: 17px; margin: 0; display: block;" /></a></div>'; 337 } 338 else { 339 $authorlink=""; 340 } 341 if ($atts["container"]=="") $yamap.='<div id="'.esc_attr($mapcontainter).'" style="position: relative; height: '.esc_attr($atts["height"]).'; margin-bottom: 0 !important;"></div>'.$authorlink; 342 343 if ($count_content>=1) $maps_count++; 344 return $yamap; 345 } 346 347 add_shortcode( 'yaplacemark', 'yaplacemark_func' ); 348 add_shortcode( 'yamap', 'yamap_func' ); 349 add_shortcode( 'yacontrol', 'yacontrol_func' ); 350 351 //Функция подключения текстового домена для локализации 352 function yamaps_plugin_load_plugin_textdomain() { 353 load_plugin_textdomain( 'yamaps', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' ); 354 } 355 add_action( 'plugins_loaded', 'yamaps_plugin_load_plugin_textdomain' ); 356 357 358 // Функция подключения скриптов и массив для локализации 359 function yamap_plugin_scripts($plugin_array) 360 { 361 362 // Plugin localization 363 364 wp_register_script('yamap_plugin', plugin_dir_url(__FILE__) . 'js/shortcode_parser.js?v=0.2'); 365 wp_enqueue_script('yamap_plugin'); 366 367 $lang_array = array('YaMap' => __('Map', 'yamaps'), 368 'AddMap' => __('Add map', 'yamaps'), 369 'EditMap' => __('Edit map', 'yamaps'), 370 'PluginTitle' => __('YaMaps plugin: Yandex.Map', 'yamaps'), 371 'MarkerTab' => __('Placemark', 'yamaps'), 372 'MapTab' => __('Map', 'yamaps'), 373 'MarkerIcon' => __('Icon', 'yamaps'), 374 'BlueOnly' => __('Blue only', 'yamaps'), 375 'MarkerUrl' => __('Link', 'yamaps'), 376 'MarkerUrlTip' => __('Placemark hyperlink url or post ID', 'yamaps'), 377 'MapHeight' => __('Map height', 'yamaps'), 378 'MarkerName' => __('Placemark name', 'yamaps'), 379 'MarkerNameTip' => __('Text for hint or icon content', 'yamaps'), 380 'MapControlsTip' => __('Use the links below', 'yamaps'), 381 'MarkerCoord' => __('Сoordinates', 'yamaps'), 382 'NoCoord' => __('Click on the map to choose or create the mark', 'yamaps'), 383 'MapControls' => __('Map controls', 'yamaps'), 384 'MarkerDelete' => __('Delete', 'yamaps'), 385 'type' => __('Map type', 'yamaps'), 386 'zoom' => __('Zoom', 'yamaps'), 387 'ScrollZoom' => __('Wheel zoom', 'yamaps'), 388 'MobileDrag' => __('Mobile drag', 'yamaps'), 389 'search' => __('Search', 'yamaps'), 390 'route' => __('Route', 'yamaps'), 391 'ruler' => __('Ruler', 'yamaps'), 392 'traffic' => __('Traffic', 'yamaps'), 393 'fullscreen' => __('Full screen', 'yamaps'), 394 'geolocation' => __('Geolocation', 'yamaps'), 395 'MarkerColor' => __('Marker color', 'yamaps'), 396 'MapContainerID' => __('Put in ID', 'yamaps'), 397 'MapContainerIDTip' => __('Do not create a block in the content. Use the existing block of the WP theme with the specified ID', 'yamaps'), 398 'Extra' => __('Extra', 'yamaps'), 399 'ExtraHTML' => __('<div style="position: relative; display: block; width: 100%; white-space: normal !important;"><h2 style="color: #444;font-size: 18px;font-weight: 600;line-height: 36px;">Want other icon types?</h2>Additional types of icons can be found by the link in the <a href="https://tech.yandex.com/maps/doc/jsapi/2.1/ref/reference/option.presetStorage-docpage/ " style="white-space: normal">Yandex.Map documentation</a>.</div><div style="position: relative; display: block; width: 100%; white-space: normal !important;"><h2 style="color: #444;font-size: 18px;font-weight: 600;line-height: 36px;">Do you like YaMaps plugin?</h2>You can support its development by donate (<a href="https://yoomoney.ru/to/41001278340150" style="white-space: normal">Yoomoney</a>) or just leave a positive feedback in the <a href="https://wordpress.org/support/plugin/yamaps/reviews/" style="white-space: normal">plugin repository</a>. It\'s very motivating!</div><div style="position: relative; display: block; width: 100%; white-space: normal !important;"><h2 style="color: #444;font-size: 18px;font-weight: 600;line-height: 36px;">Any questions?</h2>Ask in the comments <a href="https://www.yhunter.ru/portfolio/dev/yamaps/" style="white-space: normal">on the plug-in\'s page</a>, <a href="https://wordpress.org/support/plugin/yamaps" style="white-space: normal">WP support forum</a> or <a href="https://github.com/yhunter-ru/yamaps/issues" style="white-space: normal">on GitHub</a>.</div>', 'yamaps'), 400 'DeveloperInfoTab' => __('Design & Development', 'yamaps'), 401 'DeveloperInfo' => __('<div style="position: relative; display: block; width: 100%; white-space: normal !important;"><h2 style="color: #444;font-size: 18px;font-weight: 600;line-height: 36px;">Want other plugin features?</h2>Do you like the plugin but lack features for your project? For commercial modifications of the plugin, please contact me.</div><div style="position: relative; display: block; width: 100%; white-space: normal !important;"><h2 style="color: #444;font-size: 18px;font-weight: 600;line-height: 36px;">WordPress website design and development</h2>My name is Yuri and I have been creating websites for over 15 years. I have been familiar with WordPress since 2008. I know and love this CMS for its user friendly interface. This is exactly how I tried to make the interface of my YaMaps plugin, which you are currently using. If you need to create a website, make an interface design or write a plugin for WordPress - I will be happy to help you!<p style="margin-top: .5rem; text-align: center;"><b>Contacts:</b> <a href="mailto:[email protected]">[email protected]</a>, <b>telegram:</b> <a href="tg://resolve?domain=yhunter">@yhunter</a>, <b>tel:</b> <a href="tel:+79028358830">+7-902-83-588-30</a></p></div>', 'yamaps'), 402 403 ); 404 405 406 407 408 wp_localize_script('yamap_plugin', 'yamap_object', $lang_array); 409 410 global $yamaps_defaults_front; 411 wp_localize_script('yamap_plugin', 'yamap_defaults', $yamaps_defaults_front); 412 413 //enqueue TinyMCE plugin script with its ID. 414 415 $plugin_array["yamap_plugin"] = plugin_dir_url(__FILE__) . "js/btn.js?v=0.34"; 416 417 return $plugin_array; 418 419 } 420 421 422 423 424 add_filter("mce_external_plugins", "yamap_plugin_scripts", 999 ); 425 426 //Функция регистрации кнопок в редакторе 427 function register_buttons_editor($buttons) 428 { 429 //register buttons with their id. 430 array_push($buttons, "yamap"); 431 return $buttons; 432 } 433 434 435 add_filter("mce_buttons", "register_buttons_editor", 999 ); 436 437 add_action('admin_head', 'yamaps_custom_fonts', 999 ); 438 439 //Исправляем проблему со съехавшим шрифтом в Stretchy метке на карте в редакторе 440 function yamaps_custom_fonts() { 441 echo '<style> 442 .mce-container ymaps { 443 font-family: "Source Sans Pro",HelveticaNeue-Light,"Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif !important; 444 font-size: 11px !important; 445 } 446 </style>'; 447 } 448 449 450 //Подключаем шаблон шорткода 451 function yamaps_shortcode_tmpl() { 452 //Подключаем шаблон правки шорткода 453 include_once dirname(__FILE__).'/templates/tmpl-editor-yamap.html'; 454 } 455 456 add_action('admin_head', 'yamaps_shortcode_tmpl'); 457 458 //Подключаем внешние стили 459 function yamap_mce_css( $mce_css ) { 460 if ( !empty( $mce_css ) ) 461 $mce_css .= ','; 462 $mce_css .= plugins_url( 'style.content.css', __FILE__ ); 463 return $mce_css; 464 } 465 add_filter( 'mce_css', 'yamap_mce_css' ); 466 467 //Подключаем стили для нового редактора Gutenberg 468 function yamaps_gutenberg_styles() { 469 // Load the theme styles within Gutenberg. 470 wp_enqueue_style( 'yamaps-gutenberg', plugins_url( 'style.content.css', __FILE__ )); 471 } 472 add_action( 'enqueue_block_editor_assets', 'yamaps_gutenberg_styles' ); 473 474 475 if (($yamap_load_api)) { 476 add_action( 'wp_enqueue_scripts', 'YandexMapAPI_script', 5 ); 477 } 478 479 include( plugin_dir_path( __FILE__ ) . 'options.php'); 32 // Load options 33 require_once plugin_dir_path(__FILE__) . 'options.php';
Note: See TracChangeset
for help on using the changeset viewer.