예제 #1
0
        $location = wp_filter_nohtml_kses($_POST['xmaps-location-entry']);
        if ($comment_object->comment_approved) {
            XMapsDatabase::add_or_update_map_object_location($comment_id, 'map-object-comment', $location);
        } else {
            update_comment_meta($comment_id, 'xmaps-location', $location);
        }
    }
}, 99, 2);
add_action('comment_unapproved_to_approved', function ($comment) {
    $location = get_comment_meta($comment->comment_ID, 'xmaps-location', true);
    if (false !== $location) {
        XMapsDatabase::add_or_update_map_object_location($comment->comment_ID, 'map-object-comment', $location);
    }
});
add_action('trashed_comment', function ($cid) {
    XMapsDatabase::delete_map_object_location($cid, 'map-object-comment');
});
add_action('comment_form_logged_in_after', function () {
    if (get_post_type() == 'map-object') {
        ?>
<input id="xmaps-location-entry" name="xmaps-location-entry" type="hidden" />
		<div id="xmaps-controls">
			Drawing mode:
			<select id="xmaps-controls-mode">
				<option value="point">Point</option>
				<option value="area">Area</option>
			</select>
			<button id="xmaps-controls-draw">Draw</button>
			<button id="xmaps-controls-clear">Clear Map</button>
		</div>
		<div id="comment-map"></div><?php