Changeset 2380712
- Timestamp:
- 09/14/2020 03:38:23 AM (6 years ago)
- Location:
- shmapper-by-teplitsa/trunk
- Files:
-
- 11 edited
-
README.txt (modified) (1 diff)
-
assets/js/ShMapper.admin.js (modified) (1 diff)
-
assets/js/ShMapper.js (modified) (2 diffs)
-
assets/js/ShMapper_osm.js (modified) (1 diff)
-
class/ShMapPointType.class.php (modified) (1 diff)
-
class/ShMapper.class.php (modified) (4 diffs)
-
class/ShMapper_ajax.class.php (modified) (1 diff)
-
class/ShmPoint.class.php (modified) (10 diffs)
-
languages/shmapper-by-teplitsa-de_DE.mo (modified) (previous)
-
languages/shmapper-by-teplitsa-ru_RU.mo (modified) (previous)
-
shmapper.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shmapper-by-teplitsa/trunk/README.txt
r2360842 r2380712 5 5 Tags: map, OpenStreetMap, OSM, yandex.map, crowdsourcing, карта, Яндекс.карты, картирование, mapping, crowdsourced mapping, user mapping 6 6 Requires at least: 3.6.1 7 Tested up to: 5.5 7 Tested up to: 5.5.1 8 8 Requires PHP: 5.6 9 9 Stable tag: trunk -
shmapper-by-teplitsa/trunk/assets/js/ShMapper.admin.js
r2202274 r2380712 171 171 172 172 function shmMapProviderChangeHandler(mapProvider) { 173 console.log(mapProvider);174 173 if(mapProvider == 1) { 175 174 $yandexMapsAPIKeyControl.show(); -
shmapper-by-teplitsa/trunk/assets/js/ShMapper.js
r2202274 r2380712 67 67 { 68 68 $("#shm_vocabulary_cont").css("opacity", 0.7); 69 shm_send(["shm_voc", $(evt.currentTarget).attr("name"), $(evt.currentTarget).val()]); 70 }}); 69 shm_send(["shm_voc", $(evt.currentTarget).attr("name"), $(evt.currentTarget).val()]); 70 }}); 71 $("[name=shm_default_longitude]").on( 'change', function(evt) { 72 setTimeout(function(){ 73 shm_send(["shm_default_longitude", $(evt.currentTarget).val() ]); 74 },100); 75 setTimeout(function(){ 76 shm_send(["shm_default_latitude", $('[name=shm_default_latitude]').val() ]); 77 },500); 78 }); 79 $("[name=shm_default_zoom]").on( 'change', function(evt) { 80 setTimeout(function(){ 81 shm_send(["shm_default_zoom", $(evt.currentTarget).val() ]); 82 },1000); 83 }); 71 84 $("[name='map_api']").live({click:function(evt) 72 85 { … … 245 258 document.getElementsByTagName('head')[0].appendChild(style); 246 259 var classes = 'dashicons dashicons-location shm-size-40 __class'+ elem.post_id; 247 var myIcon = L.divIcon({className: classes, iconSize:L.point( 30, 40) });//260 var myIcon = L.divIcon({className: classes, iconSize:L.point(40, 40) });// 248 261 L.marker([ elem.latitude, elem.longitude ], {icon: myIcon}) 249 262 .addTo(shm_maps[elem.mapid]) -
shmapper-by-teplitsa/trunk/assets/js/ShMapper_osm.js
r2150592 r2380712 328 328 document.getElementsByTagName('head')[0].appendChild(style); 329 329 var classes = 'dashicons dashicons-location shm-size-40 __class'+ elem.post_id; 330 var myIcon = L.divIcon({className: classes, iconSize:L.point( 30, 40) });//330 var myIcon = L.divIcon({className: classes, iconSize:L.point(40, 40) });// 331 331 marker = L.marker( 332 332 [ elem.latitude, elem.longitude ], -
shmapper-by-teplitsa/trunk/class/ShMapPointType.class.php
r2126782 r2380712 344 344 if( isset($params['default_none']) ) 345 345 { 346 if ( ! isset( $class ) ) { 347 $class = ''; 348 } 346 349 $html .= " 347 350 <div class='$col_width'> -
shmapper-by-teplitsa/trunk/class/ShMapper.class.php
r2360915 r2380712 409 409 static function setting_pages() 410 410 { 411 //var_dump(static::$options); 411 $latitude = 55.8; 412 $longitude = 37.8; 413 $zoom = 4; 414 if ( static::$options['shm_default_zoom'] ) { 415 $zoom = static::$options['shm_default_zoom']; 416 } 417 if ( static::$options['shm_default_latitude'] ) { 418 $latitude = static::$options['shm_default_latitude']; 419 } 420 if ( static::$options['shm_default_longitude'] ) { 421 $longitude = static::$options['shm_default_longitude']; 422 } 423 424 $mapType = ShmMap::get_map_types()[ ShMapper::$options['map_api'] ][0]; 425 412 426 echo "<div class='shm-container shm-padding-20'> 413 427 <div class='shm-row'> … … 533 547 534 548 </div> 535 </div> 549 </div> 536 550 </li> 537 551 <li> … … 563 577 </div> 564 578 </li> 579 580 581 <li> 582 <div class='shm-row'> 583 <div class='shm-2 shm-color-grey sh-right sh-align-middle shm-title-3 '>". 584 __( "Coordinates", SHMAPPER ) . 585 "</div> 586 <div class='shm-9'> 587 <div id='map_default_coordinates' style='width:100%;height:300px;border:1px solid darkgrey;'> 588 589 </div> 590 <p> 591 <span class='shm-color-grey'><small>" . esc_html__( "Set default coordinates", SHMAPPER ) . "</small></span> 592 </p> 593 594 <script> 595 jQuery(document).ready( function($) 596 { 597 var points = []; 598 var mData = { 599 mapType : '$mapType', 600 uniq : 'map_default_coordinates', 601 muniq : 'map_default_coordinates', 602 latitude : '$latitude', 603 longitude : '$longitude', 604 zoom : '$zoom', 605 map_id : 'default_coordinates', 606 isClausterer : 0, 607 isLayerSwitcher : 0, 608 isFullscreen : 1, 609 isDesabled : 0, 610 isSearch : 1, 611 isZoomer : 1, 612 isAdmin : 0, 613 isMap : true, 614 }; 615 616 if( map_type == 1 ) { 617 ymaps.ready(() => init_map( mData, points )); 618 } else if (map_type == 2) { 619 init_map( mData, points ); 620 621 // On zoom map. 622 myMap.on('zoom', function(e) { 623 $('[name=shm_default_zoom]').val( myMap.getZoom() ).trigger('change'); 624 }); 625 626 // On move map. 627 myMap.on('move', function(e) { 628 marker.setLatLng(myMap.getCenter()); 629 }); 630 631 // On moveend map. 632 myMap.on('moveend', function(e) { 633 var shmCenter = myMap.getCenter(); 634 var shmLat = shmCenter.lat; 635 var shmLng = shmCenter.lng; 636 $('[name=shm_default_latitude]').val( shmLat ).trigger('change'); 637 $('[name=shm_default_longitude]').val( shmLng ).trigger('change'); 638 console.log($('[name=shm_default_longitude]').val()); 639 console.log($('[name=shm_default_latitude]').val()); 640 }); 641 642 // Add Center Marker. 643 var classes = 'dashicons dashicons-location shm-size-40 shm-color-danger'; 644 var myIcon = L.divIcon({className: classes, iconSize:L.point(40, 40) }); 645 marker = L.marker( 646 [ '$latitude', '$longitude' ], 647 {draggable: true, icon: myIcon} 648 ) 649 .addTo(myMap); 650 } 651 652 }); 653 </script> 654 655 <input class='sh-form' name='shm_default_latitude' value='" . esc_attr( $latitude ) . "' readonly disabled> 656 <input class='sh-form' name='shm_default_longitude' value='" . esc_attr( $longitude ) . "' readonly disabled> 657 <input class='sh-form' name='shm_default_zoom' value='" . esc_attr( $zoom ) . "' readonly disabled> 658 659 </div> 660 <div class='shm-1'></div> 661 </div> 662 </li> 565 663 <li> 566 664 <div class='shm-row' id='shm_vocabulary_cont'> … … 570 668 <div class='shm-9' id='shm_voc'> 571 669 <div class='button' id='shm_settings_wizzard' >" . __("Restart wizzard", SHMAPPER) . "</div> 572 </div> 573 <div class='shm-1'> 574 575 </div> 576 </div> 577 </li> 670 </div> 671 <div class='shm-1'></div> 672 </div 673 </li> 578 674 </ul> 579 675 </div>"; -
shmapper-by-teplitsa/trunk/class/ShMapper_ajax.class.php
r2202274 r2380712 419 419 ); 420 420 break; 421 case "shm_default_longitude": 422 ShMapper::$options['shm_default_longitude'] = sanitize_text_field($params[1]); 423 ShMapper::update_options(); 424 $d = array( 425 $action, 426 array( 427 "msg" => __( "New coordinates saved" , SHMAPPER ), 428 ), 429 ); 430 break; 431 case "shm_default_latitude": 432 ShMapper::$options['shm_default_latitude'] = sanitize_text_field($params[1]); 433 ShMapper::update_options(); 434 $d = array( 435 $action, 436 array( 437 //"msg" => __( "New coordinates saved" , SHMAPPER ), 438 ), 439 ); 440 break; 441 case "shm_default_zoom": 442 ShMapper::$options['shm_default_zoom'] = sanitize_text_field($params[1]); 443 ShMapper::update_options(); 444 $d = array( 445 $action, 446 array( 447 //"msg" => __( "New coordinates saved" , SHMAPPER ), 448 ), 449 ); 450 break; 421 451 case "shm_map_is_crowdsourced": 422 452 ShMapper::$options['shm_map_is_crowdsourced'] = sanitize_text_field($params[1]); -
shmapper-by-teplitsa/trunk/class/ShmPoint.class.php
r2154674 r2380712 1 1 <?php 2 /** 3 * ShMapper 4 * 5 * @package Teplitsa 6 */ 7 2 8 class ShmPoint extends SMC_Post 3 9 { … … 56 62 $bb = $SMC_Object_type->object [static::get_type()]; 57 63 $html = ""; 64 65 $default_latitude = 55.8; 66 $default_longitude = 37.8; 67 $default_zoom = 4; 68 if ( isset( ShMapper::$options['shm_default_latitude'] ) ) { 69 $default_latitude = ShMapper::$options['shm_default_latitude']; 70 } 71 if ( isset( ShMapper::$options['shm_default_longitude'] ) ) { 72 $default_longitude = ShMapper::$options['shm_default_longitude']; 73 } 74 if ( isset( ShMapper::$options['shm_default_zoom'] ) ) { 75 $default_zoom = ShMapper::$options['shm_default_zoom']; 76 } 58 77 foreach($bb as $key=>$value) 59 78 { … … 63 82 { 64 83 case "latitude": 65 $meta = $meta ? $meta : 55.8;84 $meta = $meta ? $meta : $default_latitude; 66 85 $opacity = " style='display:none;' " ; 67 86 break; 68 87 case "longitude": 69 $meta = $meta ? $meta : 37.8;88 $meta = $meta ? $meta : $default_longitude; 70 89 $opacity = " style='display:none;' " ; 71 90 break; 72 91 case "zoom": 73 $meta = $meta ? $meta : 4;92 $meta = $meta ? $meta : $default_zoom; 74 93 $opacity = " style='display:none;' " ; 75 94 break; … … 313 332 <input class='shm-form shm-title-4' name='shm-new-point-location' onclick='this.classList.remove(\"shm-alert\");' value='".$data[3]."'/> 314 333 </div> 315 < div>334 </div> 316 335 "; 317 336 … … 371 390 return $before . implode($separator, $d) . $after; 372 391 } 373 function draw() 374 { 392 function draw() { 393 394 $default_latitude = 55.8; 395 $default_longitude = 37.8; 396 $default_zoom = 4; 397 if ( isset( ShMapper::$options['shm_default_latitude'] ) ) { 398 $default_latitude = ShMapper::$options['shm_default_latitude']; 399 } 400 if ( isset( ShMapper::$options['shm_default_longitude'] ) ) { 401 $default_longitude = ShMapper::$options['shm_default_longitude']; 402 } 403 if ( isset( ShMapper::$options['shm_default_zoom'] ) ) { 404 $default_zoom = ShMapper::$options['shm_default_zoom']; 405 } 406 375 407 $mapType = ShmMap::get_map_types()[ ShMapper::$options['map_api'] ][0]; 376 408 $types = wp_get_object_terms($this->id, SHM_POINT_TYPE); … … 381 413 $location = $this->get_meta("location"); 382 414 $latitude = $this->get_meta("latitude"); 383 $latitude = $latitude ? $latitude : 55.8;415 $latitude = $latitude ? $latitude : $default_latitude; 384 416 $longitude = $this->get_meta("longitude"); 385 $longitude = $longitude ? $longitude : 37.8;417 $longitude = $longitude ? $longitude : $default_longitude; 386 418 387 419 $zoom = $this->get_meta("zoom"); 388 $zoom = $zoom ? $zoom : 4;420 $zoom = $zoom ? $zoom : $default_zoom; 389 421 390 422 $html = " … … 397 429 <div class='spacer-10'></div> 398 430 </div> 399 </div> "; 431 </div> "; 400 432 $point = $this->body; 401 433 402 $html .= "</div> 403 <section> 434 $html .= " 404 435 <script type='text/javascript'> 405 436 jQuery(document).ready( function($) … … 407 438 var points = [], 408 439 p = {}; 409 p.post_id = '" . $point->ID . "';410 p.post_title = '" . $post_title . "';411 p.post_content = '" . html_entity_decode( esc_js($post_content) )." <a href=\"" .get_permalink($point->ID) . "\" class=\"shm-no-uline\"> <span class=\"dashicons dashicons-location\"></span></a><div class=\"shm_ya_footer\">" . esc_js($location) . "</div>';412 p.latitude = '" . $latitude . "';413 p.longitude = '" . $longitude . "';414 p.location = '" . esc_js($location) . "';415 p.draggable = ".(is_admin() ? 1 : 0).";416 p.type = '" . $term_id . "';417 p.height = '" . get_term_meta($term_id, "height", true) . "';418 p.width = '" . get_term_meta($term_id, "width", true) . "';419 p.term_id = '" . $term_id . "';420 p.icon = '" . (ShMapPointType::get_icon_src( $term_id )[0]) . "';421 p.color = '" . get_term_meta($term_id, 'color', true) . "';422 423 points.push(p);424 /*console.log( p );*/ 440 p.post_id = '" . $point->ID . "'; 441 p.post_title = '" . $post_title . "'; 442 p.post_content = '" . html_entity_decode( esc_js($post_content) )." <a href=\"" .get_permalink($point->ID) . "\" class=\"shm-no-uline\"> <span class=\"dashicons dashicons-location\"></span></a><div class=\"shm_ya_footer\">" . esc_js($location) . "</div>'; 443 p.latitude = '" . $latitude . "'; 444 p.longitude = '" . $longitude . "'; 445 p.location = '" . esc_js($location) . "'; 446 p.draggable = ".(is_admin() ? 1 : 0)."; 447 p.type = '" . $term_id . "'; 448 p.height = '" . get_term_meta($term_id, "height", true) . "'; 449 p.width = '" . get_term_meta($term_id, "width", true) . "'; 450 p.term_id = '" . $term_id . "'; 451 p.icon = '" . (ShMapPointType::get_icon_src( $term_id )[0]) . "'; 452 p.color = '" . get_term_meta($term_id, 'color', true) . "'; 453 454 points.push(p); 455 425 456 var mData = { 426 457 mapType : '$mapType', … … 435 466 isFullscreen : 1, 436 467 isDesabled : 0, 437 isSearch : 0,468 isSearch : 1, 438 469 isZoomer : 1, 439 470 isAdmin : 1, … … 445 476 else if (map_type == 2) 446 477 init_map( mData, points ); 478 479 // Disable submit post form on this page. 480 $('form#post').on('keyup keypress', function(e) { 481 var keyCode = e.keyCode || e.which; 482 if (keyCode === 13) { 483 e.preventDefault(); 484 return false; 485 } 486 }); 447 487 }); 448 449 488 </script>"; 450 489 return $html; -
shmapper-by-teplitsa/trunk/shmapper.php
r2360804 r2380712 4 4 * Plugin URI: http://genagl.ru/?p=652 5 5 * Description: Location and logistics services for NKO 6 * Version: 1.3. 66 * Version: 1.3.7 7 7 * Author: Teplitsa. Technologies for Social Good 8 8 * Author URI: https://te-st.ru … … 12 12 * Contributors: 13 13 Genagl (genag1@list.ru) 14 Lev "ahaenor" Zvyagintsev (ahaenor@gmail.com)14 Lev "ahaenor" Zvyagintsev (ahaenor@gmail.com) 15 15 Denis Cherniatev (denis.cherniatev@gmail.com) 16 Teplitsa Support Team (suptestru@gmail.com)16 Teplitsa Support Team (suptestru@gmail.com) 17 17 18 18 * License: GPLv2 or later … … 34 34 along with this program; if not, write to the Free Software 35 35 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 36 */36 */ 37 37 38 // load textdomain 39 function init_textdomain_shmapper() 40 { 41 if (function_exists('load_textdomain')) { 42 load_textdomain("shmapper-by-teplitsa", WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) .'/languages/shmapper-by-teplitsa-'.get_locale().'.mo'); 38 /** Load textdomain */ 39 function init_textdomain_shmapper() { 40 if ( function_exists('load_textdomain') ) { 41 load_textdomain( 'shmapper-by-teplitsa', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) . '/languages/shmapper-by-teplitsa-' . get_locale() . '.mo' ); 43 42 } 44 45 if ( function_exists('load_plugin_textdomain')) {46 load_plugin_textdomain( "shmapper-by-teplitsa", false , dirname( plugin_basename( __FILE__ ) ) .'/languages/');47 } 43 44 if ( function_exists( 'load_plugin_textdomain' ) ) { 45 load_plugin_textdomain( 'shmapper-by-teplitsa', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 46 } 48 47 } 49 48 add_action('plugins_loaded', 'init_textdomain_shmapper'); 50 49 51 // Paths52 define( 'SHM_URLPATH', WP_PLUGIN_URL.'/' . plugin_basename(dirname(__FILE__)) . '/');53 define( 'SHM_REAL_PATH', WP_PLUGIN_DIR.'/'.plugin_basename(dirname(__FILE__)).'/');54 define( 'SHMAPPER', 'shmapper-by-teplitsa');55 define( 'SHM_MAP', 'shm_map');56 define( 'SHM_POINT', 'shm_point');57 define( 'SHM_POINT_TYPE', 'shm_point_type');58 define( 'SHM_REQUEST', 'shm_request');59 define( 'SHMAPPER_PLAIN_TEXT_TYPE_ID', 1);60 define( 'SHMAPPER_NAME_TYPE_ID', 2);61 define( 'SHMAPPER_PLAIN_NUMBER_TYPE_ID', 3);62 define( 'SHMAPPER_EMAIL_TYPE_ID', 4);63 define( 'SHMAPPER_PHONE_TYPE_ID', 5);64 define( 'SHMAPPER_TEXTAREA_TYPE_ID', 6);65 define( 'SHMAPPER_IMAGE_TYPE_ID', 7);66 define( 'SHMAPPER_MARK_TYPE_ID', 8);67 define( 'SHMAPPER_TITLE_TYPE_ID', 9);68 define( 'SHM_CSV_STROKE_SEPARATOR', ';');69 define( 'SHM_CSV_ROW_SEPARATOR', '50 // Paths. 51 define( 'SHM_URLPATH', WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/' ); 52 define( 'SHM_REAL_PATH', WP_PLUGIN_DIR . '/' . plugin_basename(dirname(__FILE__) ) . '/' ); 53 define( 'SHMAPPER', 'shmapper-by-teplitsa' ); 54 define( 'SHM_MAP', 'shm_map' ); 55 define( 'SHM_POINT', 'shm_point' ); 56 define( 'SHM_POINT_TYPE', 'shm_point_type' ); 57 define( 'SHM_REQUEST', 'shm_request' ); 58 define( 'SHMAPPER_PLAIN_TEXT_TYPE_ID', 1 ); 59 define( 'SHMAPPER_NAME_TYPE_ID', 2 ); 60 define( 'SHMAPPER_PLAIN_NUMBER_TYPE_ID', 3 ); 61 define( 'SHMAPPER_EMAIL_TYPE_ID', 4 ); 62 define( 'SHMAPPER_PHONE_TYPE_ID', 5 ); 63 define( 'SHMAPPER_TEXTAREA_TYPE_ID', 6 ); 64 define( 'SHMAPPER_IMAGE_TYPE_ID', 7 ); 65 define( 'SHMAPPER_MARK_TYPE_ID', 8 ); 66 define( 'SHMAPPER_TITLE_TYPE_ID', 9 ); 67 define( 'SHM_CSV_STROKE_SEPARATOR', ';' ); 68 define( 'SHM_CSV_ROW_SEPARATOR', ' 70 69 '); 71 define('SHMAPPER_VERSION', '1.3.3' );70 define('SHMAPPER_VERSION', '1.3.3' ); 72 71 73 require_once(SHM_REAL_PATH.'class/ShMapper.class.php'); 74 require_once(SHM_REAL_PATH.'class/ShMapper_ajax.class.php'); 75 if(!class_exists("SMC_Post")) 76 require_once(SHM_REAL_PATH.'class/SMC_Post.php'); 77 if(!class_exists("SMC_Object_type")) 78 require_once(SHM_REAL_PATH.'class/SMC_Object_type.php'); 79 require_once(SHM_REAL_PATH.'class/ShmMap.class.php'); 80 require_once(SHM_REAL_PATH.'class/ShMapPointType.class.php'); 81 require_once(SHM_REAL_PATH.'class/ShmPoint.class.php'); 82 require_once(SHM_REAL_PATH.'class/ShMapperRequest.class.php'); 83 require_once(SHM_REAL_PATH.'class/ShmForm.class.php'); 84 require_once(SHM_REAL_PATH.'class/ShMapper_Assistants.class.php'); 85 require_once(SHM_REAL_PATH.'class/ShmAdminPage.class.php'); 86 require_once(SHM_REAL_PATH.'shortcode/shm_shortcodes.php'); 87 require_once(SHM_REAL_PATH.'widget/ShMap.widget.php'); 72 require_once SHM_REAL_PATH . 'class/ShMapper.class.php'; 73 require_once SHM_REAL_PATH . 'class/ShMapper_ajax.class.php'; 74 if ( ! class_exists( 'SMC_Post' ) ) { 75 require_once SHM_REAL_PATH . 'class/SMC_Post.php'; 76 } 77 if ( ! class_exists( 'SMC_Object_type' ) ) { 78 require_once SHM_REAL_PATH . 'class/SMC_Object_type.php'; 79 } 80 require_once SHM_REAL_PATH . 'class/ShmMap.class.php'; 81 require_once SHM_REAL_PATH . 'class/ShMapPointType.class.php'; 82 require_once SHM_REAL_PATH . 'class/ShmPoint.class.php'; 83 require_once SHM_REAL_PATH . 'class/ShMapperRequest.class.php'; 84 require_once SHM_REAL_PATH . 'class/ShmForm.class.php'; 85 require_once SHM_REAL_PATH . 'class/ShMapper_Assistants.class.php'; 86 require_once SHM_REAL_PATH . 'class/ShmAdminPage.class.php'; 87 require_once SHM_REAL_PATH . 'shortcode/shm_shortcodes.php'; 88 require_once SHM_REAL_PATH . 'widget/ShMap.widget.php'; 88 89 89 90 register_activation_hook( __FILE__, array( 'ShMapper', 'activate' ) ); 90 if (function_exists('register_deactivation_hook')) 91 {92 register_deactivation_hook(__FILE__, array( 'ShMapper', 'deactivate'));91 92 if ( function_exists( 'register_deactivation_hook' ) ) { 93 register_deactivation_hook(__FILE__, array( 'ShMapper', 'deactivate' ) ); 93 94 } 94 add_action("init", "init_shmapper", 1); 95 function init_shmapper() 96 {95 96 /** Shamapper init */ 97 function init_shmapper() { 97 98 ShMapper::get_instance(); 98 99 ShMapper_Assistants::get_instance(); … … 104 105 ShmForm::init(); 105 106 } 106 function shm_is_session() 107 { 108 require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 109 return is_plugin_active( 'wp-session-manager/wp-session-manager.php' ) ; 107 add_action( 'init', 'init_shmapper', 1 ); 108 109 /** Is session */ 110 function shm_is_session() { 111 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 112 return is_plugin_active( 'wp-session-manager/wp-session-manager.php' ); 110 113 } 111 114 112 function shmapper_prefix_disable_gutenberg($current_status, $post_type) { 113 if(in_array($post_type, array(SHM_POINT))) { 114 return false; 115 } 116 return $current_status; 115 /** 116 * Disable Gugenberg 117 * @param bool $current_status Current gutenberg status. Default true. 118 * @param string $post_type The post type being checked. 119 */ 120 function shmapper_disable_gutenberg( $current_status, $post_type ) { 121 if ( in_array( $post_type, array( SHM_POINT ), true ) ) { 122 return false; 123 } 124 return $current_status; 117 125 } 118 add_filter( 'use_block_editor_for_post_type', 'shmapper_prefix_disable_gutenberg', 10, 2);126 add_filter( 'use_block_editor_for_post_type', 'shmapper_disable_gutenberg', 10, 2);
Note: See TracChangeset
for help on using the changeset viewer.