IT実践

Google Maps Anywhere と FCKEditor の共存

  • このエントリーをはてなブックマークに追加
  • LINEで送る

WordPressで非常に優れているプラグインGoogle Maps AnywhereFCKEditorだが、両方インストールすると、Google Map 表示用コードまでが自動整形されてしまい、マップが表示されない。

googlemaps-anywhere.phpの489行目を以下のように変更することで解決。(PHP4 , PHP5 対応)

478     function addGoogleMap($content) {
479         if ( is_single() && !class_exists(‘Lightweight_Google_Maps’) ) {
480             global $post;
481             $latlng = get_post_meta($post->ID, ‘Lat_Long’, true);
482             if ( !empty($latlng) ) {
483                 list($lat,$long) = split(‘,’, $latlng);
484                 $content .= ‘<p>’
485                     . “[googlemap lat=\”{$lat}\” lng=\”{$long}\” zoom=\”13\” type=\”G_NORMAL_MAP\”]{$lat},{$long}[/googlemap]”
486                     . ‘</p>’;
487             }
488         }
489         return $content;
490     }
491 }

478     function addGoogleMap($content) {
479         if ( is_single() && !class_exists(‘Lightweight_Google_Maps’) ) {
480             global $post;
481             $latlng = get_post_meta($post->ID, ‘Lat_Long’, true);
482             if ( !empty($latlng) ) {
483                 list($lat,$long) = split(‘,’, $latlng);
484                 $content .= ‘<p>’
485                     . “[googlemap lat=\”{$lat}\” lng=\”{$long}\” zoom=\”13\” type=\”G_NORMAL_MAP\”]{$lat},{$long}[/googlemap]”
486                     . ‘</p>’;
487             }
488         }
489         return strtr($content, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
490     }
491 }

関連記事