Skip to content

Instantly share code, notes, and snippets.

@hissy
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hissy/ed0f5d2b57213ceffab3 to your computer and use it in GitHub Desktop.
Save hissy/ed0f5d2b57213ceffab3 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Really Simple CSV Importer add-on: Comma
Version: 0.1
*/
class rscsvimporter_comma {
// singleton instance
private static $instance;
public static function instance() {
if ( isset( self::$instance ) )
return self::$instance;
self::$instance = new rscsvimporter_comma;
self::$instance->run_init();
return self::$instance;
}
private function __construct() {
/** Do nothing **/
}
protected function run_init() {
add_action( 'init', array( $this, 'add_filter' ) );
}
public function add_filter() {
add_filter( 'really_simple_csv_importer_save_tax', array( $this, 'replace_comma'), 10, 3 );
}
public function replace_comma($tax, $post, $is_update) {
$_tax = array();
foreach ($tax as $tax_name => $terms) {
$_term = array();
foreach ($terms as $term) {
$_term[] = str_replace('..', ',', $term);
}
$_tax[$tax_name] = $_term;
}
return $_tax;
}
}
$rscsvimporter_comma = rscsvimporter_comma::instance();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment