Advertisement
johnrom

woo-product-importer non-static method fix

Oct 24th, 2013
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.75 KB | None | 0 0
  1. <?php /*
  2.     Plugin Name: Woo Product Importer
  3.     Plugin URI: http://webpresencepartners.com/2012/09/19/a-free-simple-woocommerce-csv-importer/
  4.     Description: Free CSV import utility for WooCommerce
  5.     Version: 1
  6.     Author: Daniel Grundel, Web Presence Partners
  7.     Author URI: http://www.webpresencepartners.com
  8.     Text Domain: woo-product-importer
  9.     Domain Path: /languages/
  10. */
  11.  
  12. /*
  13.     This file is part of Woo Product Importer.
  14.    
  15.     Woo Product Importer is Copyright 2012-2013 Web Presence Partners LLC.
  16.  
  17.     Woo Product Importer is free software: you can redistribute it and/or modify
  18.     it under the terms of the GNU Lesser General Public License as published by
  19.     the Free Software Foundation, either version 3 of the License, or
  20.     (at your option) any later version.
  21.    
  22.     Woo Product Importer is distributed in the hope that it will be useful,
  23.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  24.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  25.     GNU Lesser General Public License for more details.
  26.    
  27.     You should have received a copy of the GNU Lesser General Public License
  28.     along with Woo Product Importer.  If not, see <http://www.gnu.org/licenses/>.
  29. */
  30.    
  31.     class WebPres_Woo_Product_Importer {
  32.        
  33.         public function __construct() {
  34.             add_action('init', array( &$this, 'translations' ), 1 );
  35.             add_action('admin_menu', array( &$this, 'admin_menu') );
  36.             add_action('wp_ajax_woo-product-importer-ajax', array( &$this, 'render_ajax_action') );
  37.         }
  38.  
  39.         public function translations() {
  40.             load_plugin_textdomain('woo-product-importer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
  41.         }
  42.  
  43.         public function admin_menu() {
  44.             add_management_page(
  45.                 __('Woo Product Importer', 'woo-product-importer'),
  46.                 __('Woo Product Importer', 'woo-product-importer'),
  47.                 'manage_options',
  48.                 'woo-product-importer',
  49.                 array( &$this, 'render_admin_action' )
  50.             );
  51.         }
  52.        
  53.         public function render_admin_action() {
  54.             $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'upload';
  55.  
  56.             require_once( plugin_dir_path(__FILE__) . 'woo-product-importer-common.php');
  57.             require_once( plugin_dir_path(__FILE__) . "woo-product-importer-{$action}.php");
  58.         }
  59.        
  60.         public function render_ajax_action() {
  61.             require_once( plugin_dir_path(__FILE__) . "woo-product-importer-ajax.php");
  62.             die(); // this is required to return a proper result
  63.         }
  64.     }
  65.    
  66.     $webpres_woo_product_importer = new WebPres_Woo_Product_Importer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement