<commit_before><?php

// pluginname A2Billing
// shortname A2Billing
// dashname A2Billing

/*
Plugin Name: A2Billing
Version: 1.0
Plugin URI: http://www.asterisk2billing.org/cgi-bin/trac.cgi/wiki/WordPress-plugins
Author: <NAME> <<EMAIL>>
Description: A2Billing allows you to display information relative to A2Billing into WordPress, such as Rates

*/


global $wp_version;	

$exit_msg='A2Billing requires WordPress 2.3 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>';

if (version_compare($wp_version,"2.3","<"))
{
	exit ($exit_msg);
}


include_once (dirname(__FILE__)."/functions.php");


// Avoid name collisions.
if ( !class_exists('A2Billing') ) :

class A2Billing {
	
	// Name for our options in the DB
	var $DB_option = 'A2Billing_options';
	
	// the plugin URL
	var $plugin_url;
	
	// plugin language textdomain
	var $plugin_domain='A2Billing';  
	
	
	// Initialize WordPress hooks
	function A2Billing() {
		
		$this->plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
		
		$this->handle_load_domain();
		$options = $this->get_options();
		
		//add_filter('the_content',  array(&$this, 'content_filter'), 10);	
		// Add Options Page
		add_action('admin_menu',  array(&$this, 'admin_menu'));
		
		// add shortcode handler
		add_shortcode('a2billing_rates', array(&$this, 'a2billing_rates_func'));
		
	}
	
	
	// Hook the admin menu
	function admin_menu() {
		add_options_page('A2Billing Options', 'A2Billing', 8, basename(__FILE__), array(&$this, 'handle_options'));
	}
	
		// shortcode_handler
	// $atts    ::= array of attributes
	// $content ::= text within enclosing form of shortcode element
	// $code    ::= the shortcode found, when == callback name
	// example : [my-shortcode foo='bar']content[/my-shortcode]
	// [a2billing_rates id='1']
	function a2billing_rates_func( $atts, $content=null, $code="" )
	{	
		extract(shortcode_atts(array(
			'callplan_id' => '1'
		), $atts));
		
		$options = $this->get_options();
		
		$callplan_clause = "";
		if ($callplan_id >= 1 && $callplan_id < 100000) {
			$callplan_clause = "&tariffgroupid=$callplan_id";
		}
		
		$url_get_rates = $options["url_a2billing_rates"];
		
		if (!strlen($url_get_rates) > 10) {
			return "Wrong URL for id : $id";
		}
	
		$curPageURL = get_curPageURL();
		$private_key = $options["api_private_key"];
	
		$private_key_md5 = md5($private_key);
		$url_wordpress_ratepage = $options["url_wordpress_ratepage"];
	
		$api_url = $url_get_rates . "?" .
					"key=$private_key_md5" .
					"&page_url=$curPageURL" .
					"&field_to_display=t1.destination,t1.dialprefix,t1.rateinitial" .
					"&column_name=Destination,Prefix,Rate/Min&field_type=,,money" .
					"&fullhtmlpage=0&filter=prefix".
					"$callplan_clause".
					"&".$_SERVER['QUERY_STRING'];
					#"&".$_SERVER['REDIRECT_QUERY_STRING']
		// if you have some issue with the filter, you can try using REDIRECT_QUERY_STRING instead of QUERY_STRING
		// This might be due to rewrite rules avoiding to get _SERVER['QUERY_STRING']
		
		$content = a2b_open_url ($api_url);
		
		return $content;
		
	}<commit_msg>minor fix on wordpress plugins<commit_after><?php

// pluginname A2Billing
// shortname A2Billing
// dashname A2Billing

/*
Plugin Name: A2Billing
Version: 1.0
Plugin URI: http://www.asterisk2billing.org/cgi-bin/trac.cgi/wiki/WordPress-plugins
Author: <NAME> <<EMAIL>>
Description: A2Billing allows you to display information relative to A2Billing into WordPress, such as Rates

*/


global $wp_version;	

$exit_msg='A2Billing requires WordPress 2.3 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>';

if (version_compare($wp_version,"2.3","<"))
{
	exit ($exit_msg);
}


include_once (dirname(__FILE__)."/functions.php");


// Avoid name collisions.
if ( !class_exists('A2Billing') ) :

class A2Billing {
	
	// Name for our options in the DB
	var $DB_option = 'A2Billing_options';
	
	// the plugin URL
	var $plugin_url;
	
	// plugin language textdomain
	var $plugin_domain='A2Billing';  
	
	
	// Initialize WordPress hooks
	function A2Billing() {
		
		$this->plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
		
		$this->handle_load_domain();
		$options = $this->get_options();
		
		//add_filter('the_content',  array(&$this, 'content_filter'), 10);	
		// Add Options Page
		add_action('admin_menu',  array(&$this, 'admin_menu'));
		
		// add shortcode handler
		add_shortcode('a2billing_rates', array(&$this, 'a2billing_rates_func'));
		
	}
	
	
	// Hook the admin menu
	function admin_menu() {
		add_options_page('A2Billing Options', 'A2Billing', 8, basename(__FILE__), array(&$this, 'handle_options'));
	}
	
		// shortcode_handler
	// $atts    ::= array of attributes
	// $content ::= text within enclosing form of shortcode element
	// $code    ::= the shortcode found, when == callback name
	// example : [my-shortcode foo='bar']content[/my-shortcode]
	// [a2billing_rates id='1']
	function a2billing_rates_func( $atts, $content=null, $code="" )
	{	
		extract(shortcode_atts(array(
			'callplan_id' => '1'
		), $atts));
		
		$options = $this->get_options();
		
		$callplan_clause = "";
		if ($callplan_id >= 1 && $callplan_id < 100000) {
			$callplan_clause = "&tariffgroupid=$callplan_id";
		}
		
		$url_get_rates = $options["url_a2billing_rates"];
		
		if (!strlen($url_get_rates) > 10) {
			return "Wrong URL for id : $id";
		}
	
		$curPageURL = get_curPageURL();
		$private_key = $options["api_private_key"];
	
		$private_key_md5 = md5($private_key);
		$url_wordpress_ratepage = $options["url_wordpress_ratepage"];
	
		$api_url = $url_get_rates . "?" .
					"key=$private_key_md5" .
					"&page_url=$curPageURL" .
					"&field_to_display=t1.destination,t1.dialprefix,t1.rateinitial" .
					"&column_name=Destination,Prefix,Rate/Min&field_type=,,money" .
					"&fullhtmlpage=0&filter=prefix".
					"$callplan_clause".
					"&".$_SERVER['QUERY_STRING'];
					#"&".$_SERVER['REDIRECT_QUERY_STRING'];
		// if you have some issue with the filter, you can try using REDIRECT_QUERY_STRING instead of QUERY_STRING
		// This might be due to rewrite rules avoiding to get _SERVER['QUERY_STRING']
		
		$content = a2b_open_url ($api_url);
		
		return $content;
		
	}
{'fraction_non_alphanumeric': 0.1517318080711789, 'fraction_numerical': 0.015252621544327931, 'mean_word_length': 4.2502085070892415, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3741555', 'n_tokens_mistral': 2517, 'n_tokens_neox': 2208, 'n_words': 454}