<commit_before>
<?php
/*
Plugin Name: Placeling
Plugin URI: https://www.placeling.com
Description: Tag your posts with location data from Placeling!
Version: 0.1
Author: Placeling (Internet Services) Inc.
Author URI: https://www.placeling.com
*/

include_once('OAuthSimple.php');
include_once('simple_html_dom.php');
include_once('pinta-config.php');

if (!class_exists("Placeling")) {
	class Placeling {
		function Placeling() { 
			// Add Options Page
			add_action( 'admin_menu',  array(&$this, 'admin_menu') );
			add_action( 'save_post', array( &$this, 'save_post') );
			add_filter( 'media_buttons_context', array(&$this, 'placeling_media_button') );
			add_filter( 'the_content', array(&$this, 'addPlacelingFooter') );
			
		}
		
			// Hook the options mage
		function admin_menu() {
			add_meta_box( 'WPPlaceling', 'Placeling', array(&$this,'draw_placeling'), 'post', 'normal', 'high' );
		} 
		
		
		function addPlacelingFooter( $content ){
		
			if ( !is_single() ){
				//we only want to show on single views, for now,  so as not to crowd
				return $content;
			}
			
		  	$post_ID = $GLOBALS['post']->ID;
			
		  	$meta_value = get_post_meta($post_ID, '_placeling_place_json', true);			
			
			if ( strlen( $meta_value ) > 0 ){
				$place_json = urldecode( $meta_value );
				$place = json_decode( $place_json );
				
				wp_enqueue_style( 'footer', plugins_url( 'css/footer.css', __FILE__ ) );
				
				include("footer.php");
		  		$content = $content .footerHtml( $place, plugins_url( 'img/addPlace.png', __FILE__ ) );
		  	}
		  	
		  	return $content;
		}
		
		function draw_placeling(){
			global $post_ID;
			
			wp_enqueue_script( 'jquery' );
			wp_enqueue_script( 'jquery-validate',  plugins_url( 'js/jquery.validate.min.js' , __FILE__ ), array('jquery') );
			wp_enqueue_script( 'postnew', plugins_url( 'js/postnew.js', __FILE__ ), array('jquery', 'underscore') );
			wp_enqueue_script( 'underscore', plugins_url( 'js/underscore-min.js' , __FILE__ ), array('jquery') );
			wp_enqueue_style( 'pinta', plugins_url( 'css/pinta.css' , __FILE__ ) );
			
			$empty_marker_button = plugins_url( 'img/EmptyMarker.png' , __FILE__ );
			
			$meta_value = get_post_meta($post_ID, '_placeling_place_json', true);
			
			?>
				<input id="placeling_place_json" name="placeling_place_json" type="hidden" value="<?php echo $meta_value ; ?>" />				
				
				<div id="placeling_dialog_form" title="Post to Placeling">
			
				</div>
				
				<div id="empty_place">
					<a id='add_place' href='<?php echo plugins_url( 'popup/index.php' , __FILE__ ); ?>?TB_iframe=true&height=500&width=660' class='thickbox' alt='foo' title='Tag Place'><img src='<?php echo $empty_marker_button; ?>' />Add place</a>
				</div>
				
				<div id="placeling_tagged_place" style="display:none;">

				</div>
	
			<?php
		}
		
		function postToPlaceling( $post_ID ){
			
			$placemark_memo = $_POST['placeling_placemark_memo'];<commit_msg>needs a "global" to recognize the url<commit_after>
<?php
/*
Plugin Name: Placeling
Plugin URI: https://www.placeling.com
Description: Tag your posts with location data from Placeling!
Version: 0.1
Author: Placeling (Internet Services) Inc.
Author URI: https://www.placeling.com
*/

include_once('OAuthSimple.php');
include_once('simple_html_dom.php');
include_once('pinta-config.php');

if (!class_exists("Placeling")) {
	class Placeling {
		function Placeling() { 
			// Add Options Page
			add_action( 'admin_menu',  array(&$this, 'admin_menu') );
			add_action( 'save_post', array( &$this, 'save_post') );
			add_filter( 'media_buttons_context', array(&$this, 'placeling_media_button') );
			add_filter( 'the_content', array(&$this, 'addPlacelingFooter') );
			
		}
		
			// Hook the options mage
		function admin_menu() {
			add_meta_box( 'WPPlaceling', 'Placeling', array(&$this,'draw_placeling'), 'post', 'normal', 'high' );
		} 
		
		
		function addPlacelingFooter( $content ){
		
			if ( !is_single() ){
				//we only want to show on single views, for now,  so as not to crowd
				return $content;
			}
			
		  	$post_ID = $GLOBALS['post']->ID;
			
		  	$meta_value = get_post_meta($post_ID, '_placeling_place_json', true);			
			
			if ( strlen( $meta_value ) > 0 ){
				$place_json = urldecode( $meta_value );
				$place = json_decode( $place_json );
				
				wp_enqueue_style( 'footer', plugins_url( 'css/footer.css', __FILE__ ) );
				
				include("footer.php");
		  		$content = $content .footerHtml( $place, plugins_url( 'img/addPlace.png', __FILE__ ) );
		  	}
		  	
		  	return $content;
		}
		
		function draw_placeling(){
			global $post_ID;
			
			wp_enqueue_script( 'jquery' );
			wp_enqueue_script( 'jquery-validate',  plugins_url( 'js/jquery.validate.min.js' , __FILE__ ), array('jquery') );
			wp_enqueue_script( 'postnew', plugins_url( 'js/postnew.js', __FILE__ ), array('jquery', 'underscore') );
			wp_enqueue_script( 'underscore', plugins_url( 'js/underscore-min.js' , __FILE__ ), array('jquery') );
			wp_enqueue_style( 'pinta', plugins_url( 'css/pinta.css' , __FILE__ ) );
			
			$empty_marker_button = plugins_url( 'img/EmptyMarker.png' , __FILE__ );
			
			$meta_value = get_post_meta($post_ID, '_placeling_place_json', true);
			
			?>
				<input id="placeling_place_json" name="placeling_place_json" type="hidden" value="<?php echo $meta_value ; ?>" />				
				
				<div id="placeling_dialog_form" title="Post to Placeling">
			
				</div>
				
				<div id="empty_place">
					<a id='add_place' href='<?php echo plugins_url( 'popup/index.php' , __FILE__ ); ?>?TB_iframe=true&height=500&width=660' class='thickbox' alt='foo' title='Tag Place'><img src='<?php echo $empty_marker_button; ?>' />Add place</a>
				</div>
				
				<div id="placeling_tagged_place" style="display:none;">

				</div>
	
			<?php
		}
		
		function postToPlaceling( $post_ID ){
			global $SERVICE_HOSTNAME;
			$placemark_memo = $_POST['placeling_placemark_memo'];
{'fraction_non_alphanumeric': 0.15888643693770158, 'fraction_numerical': 0.0030555084026481073, 'mean_word_length': 3.993220338983051, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 35, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '848662', 'n_tokens_mistral': 2441, 'n_tokens_neox': 2059, 'n_words': 413}