/**
 * Load the plugin text domain for translation
 *
 * @since    1.1.3
 */
function angelleye_ofwc_load_plugin_textdomain()
{
    $plugin = Angelleye_Offers_For_Woocommerce::get_instance();
    $plugin_slug = $plugin->get_plugin_slug();
    $locale = apply_filters('plugin_locale', get_locale(), $plugin_slug);
    $plugin_rel_path = plugin_dir_path(__FILE__);
    $mo_file_path = $plugin_rel_path . 'languages/' . $plugin_slug . '-' . $locale . '.mo';
    if ($locale != 'en_US') {
        $loadplugintextdomain = load_plugin_textdomain($plugin_slug, FALSE, dirname(plugin_basename(__FILE__)) . '/languages');
        if (!$loadplugintextdomain) {
            if (file_exists($mo_file_path) && is_admin()) {
                echo '<div class="notice error">';
                echo '<p>' . __('<strong>Error: </strong>Offers for WooCommerce language translation file could not be loaded', $plugin_slug) . '</p>';
                echo '</div>';
            }
        }
    }
}
 /**
  * Initialize the plugin by loading admin scripts & styles and adding a settings page and menu
  * @since     0.1.0
  */
 private function __construct()
 {
     /**
      * Define email templates path
      */
     if (!defined('OFWC_EMAIL_TEMPLATE_PATH')) {
         define('OFWC_EMAIL_TEMPLATE_PATH', untrailingslashit(plugin_dir_path(__FILE__)) . '/includes/emails/');
     }
     /**
      * Call $plugin_slug from public plugin class
      * @since	0.1.0
      */
     $plugin = Angelleye_Offers_For_Woocommerce::get_instance();
     $this->plugin_slug = $plugin->get_plugin_slug();
     // Load admin style sheet and JavaScript.
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
     // Add the options page and menu item.
     add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
     /**
      * Filter - Add links to plugin meta
      * @since   1.1.2
      */
     add_filter('plugin_row_meta', array($this, 'ofwc_add_plugin_action_links'), 10, 2);
     /**
      *******************************
      * Define custom functionality *
      *******************************
      */
     /**
      * Action - Add post type "woocommerce_offer" 
      *
      * @since	0.1.0
      */
     add_action('init', array($this, 'angelleye_ofwc_add_post_type_woocommerce_offer'));
     /**
      * XXX
      * @since	0.1.0
      */
     add_filter('manage_woocommerce_offer_posts_columns', array($this, 'set_woocommerce_offer_columns'));
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('manage_woocommerce_offer_posts_custom_column', array($this, 'get_woocommerce_offer_column'), 2, 10);
     /**
      * XXX
      * @since	0.1.0
      */
     add_filter('manage_edit-woocommerce_offer_sortable_columns', array($this, 'woocommerce_offer_sortable_columns'));
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('admin_init', array($this, 'remove_woocommerce_offer_meta_boxes'));
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('admin_menu', array($this, 'my_remove_submenus'));
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('init', array($this, 'comments_exclude_lazy_hook'), 0);
     /**
      * XXX
      * @since	0.1.0
      */
     add_filter('post_row_actions', array($this, 'remove_quick_edit'), 10, 2);
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('init', array($this, 'my_custom_post_status_accepted'), 10, 2);
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('init', array($this, 'my_custom_post_status_countered'), 10, 2);
     /**
      * Adds post_status 'on-hold-offer'
      * @since	1.0.1
      */
     add_action('init', array($this, 'my_custom_post_status_on_hold'), 10, 2);
     /**
      * Adds post_status 'expired-offer'
      * @since	1.0.1
      */
     add_action('init', array($this, 'my_custom_post_status_expired'), 10, 2);
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('init', array($this, 'my_custom_post_status_buyer_countered'), 10, 2);
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('init', array($this, 'my_custom_post_status_completed'), 10, 2);
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('init', array($this, 'my_custom_post_status_declined'), 10, 2);
     /**
      * XXX
      * @since	0.1.0
      */
     add_filter('display_post_states', array($this, 'jc_display_archive_state'));
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('current_screen', array($this, 'translate_published_post_label'), 10, 2);
     /**
      * XXX
      * @since	0.1.0
      */
     add_filter('bulk_actions-edit-woocommerce_offer', array($this, 'my_custom_bulk_actions'));
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('add_meta_boxes', array($this, 'add_meta_box_offer_summary'), 10, 2);
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('add_meta_boxes', array($this, 'add_meta_box_offer_comments'), 10, 2);
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('add_meta_boxes', array($this, 'add_meta_box_offer_addnote'), 10, 2);
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('save_post', array($this, 'myplugin_save_meta_box_data'));
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('admin_init', array($this, 'angelleye_ofwc_intialize_options'));
     /**
      * Action - Admin Menu - Add the 'pending offer' count bubble
      * @since	0.1.0
      */
     add_action('admin_menu', array($this, 'add_user_menu_bubble'));
     /**
      * Action - Add 'pending offer(s)' count to wp dashboard 'at a glance' widget
      * @since	0.1.0
      */
     add_action('dashboard_glance_items', array($this, 'my_add_cpt_to_dashboard'));
     /**
      * Action - Admin Menu - Add child submenu items for the woocommerce->offers submenu
      * @since	0.1.0
      */
     add_action('admin_menu', array($this, 'add_offers_submenu_children'));
     /**
      * Process meta
      *
      * Processes the custom tab options when a post is saved
      * @since	0.1.0
      */
     add_action('woocommerce_process_product_meta', array($this, 'process_product_meta_custom_tab'), 10, 2);
     /**
      * Output WooCommerce Tab on product single
      * @since	0.1.0
      */
     add_action('woocommerce_product_write_panel_tabs', array($this, 'custom_tab_options_tab_offers'));
     /*
      * Action - Add custom tab options in WooCommerce product tabs
      * @since	0.1.0
      */
     add_action('woocommerce_product_write_panels', array($this, 'custom_tab_options_offers'));
     /**
      * Override updated message for custom post type
      *
      * @param array $messages Existing post update messages.
      *
      * @return array Amended post update messages with new CPT update messages.
      * @since	0.1.0
      */
     add_filter('post_updated_messages', array($this, 'my_custom_updated_messages'));
     /*
      * ADMIN COLUMN - SORTING - ORDERBY
      * http://scribu.net/wordpress/custom-sortable-columns.html#comment-4732
      */
     add_filter('request', array($this, 'woocommerce_offers_list_orderby'));
     /*
      * ADD TO QUERY - PULL IN all except 'trash' when viewing 'all' list
      * @since	0.1.0
      */
     add_action('pre_get_posts', array($this, 'my_pre_get_posts'));
     /**
      * Join posts and postmeta tables
      * @since   1.0.1
      */
     add_filter('posts_join', array($this, 'aeofwc_search_join'));
     /**
      * Modify the search query with posts_where
      * @since   1.0.1
      */
     add_filter('posts_where', array($this, 'aeofwc_search_where'));
     /**
      * Prevent duplicates
      * @since   1.0.1
      */
     add_filter('posts_distinct', array($this, 'aeofwc_search_distinct'));
     /*
      * Action - Ajax 'approve offer' from manage list
      * @since	0.1.0
      */
     add_action('wp_ajax_approveOfferFromGrid', array($this, 'approveOfferFromGridCallback'));
     /*
      * Action - Ajax 'decline offer' from manage list
      * @since	0.1.0
      */
     add_action('wp_ajax_declineOfferFromGrid', array($this, 'declineOfferFromGridCallback'));
     /*
      * Action - Ajax 'add offer note' from manage offer details
      * @since	0.1.0
      */
     add_action('wp_ajax_addOfferNote', array($this, 'addOfferNoteCallback'));
     /*
      * Action - Ajax 'bulk enable/disable tool' from offers settings/tools
      * @since	0.1.0
      */
     add_action('wp_ajax_adminToolBulkEnableDisable', array($this, 'adminToolBulkEnableDisableCallback'));
     /*
      * Filter - Add email class to WooCommerce for 'Accepted Offer'
      * @since   0.1.0
      */
     add_filter('woocommerce_email_classes', array($this, 'add_woocommerce_email_classes'));
     /**
      * XXX
      * @since	0.1.0
      */
     add_action('admin_notices', array($this, 'aeofwc_admin_notices'));
     /**
      * Adds help tab content for manage offer screen
      * @since   0.1.0
      */
     add_filter('contextual_help', array($this, 'ae_ofwc_contextual_help'), 10, 3);
     /**
      * Check for WooCommerce plugin
      * Adds nag message to admin notice
      * @since   1.0.1
      */
     add_action('admin_init', array($this, 'ae_ofwc_check_woocommerce_nag_notice_ignore'));
     add_action('admin_init', array($this, 'ae_ofwc_check_woocommerce_available'));
     /**
      * Action - Bulk action - Enable/Disable Offers on WooCommerce products
      * @since   1.0.1
      */
     add_action('admin_footer-edit.php', array($this, 'custom_bulk_admin_footer'));
     /**
      * Action - Bulk action - Process Enable/Disable Offers on WooCommerce products
      * @since   1.0.1
      */
     add_action('load-edit.php', array($this, 'custom_bulk_action'));
     /**
      * Action - Show admin notice for bulk action Enable/Disable Offers on WooCommerce products
      * @since   1.0.1
      */
     add_action('admin_notices', array($this, 'custom_bulk_admin_notices'));
     /**
      * Action - Quick edit - Process Enable/Disable Offers on WooCommerce products display field
      * @since   1.2
      */
     add_action('woocommerce_product_quick_edit_end', array($this, 'woocommerce_product_quick_edit_end_own'), 10);
     /**
      * Action - Quick edit - Process Enable/Disable Offers on WooCommerce products save field
      * @since   1.2
      */
     add_action('woocommerce_product_quick_edit_save', array($this, 'woocommerce_product_quick_edit_save_own'), 10, 1);
     /**
      * Action - Bulk edit - Process Enable/Disable Offers on WooCommerce products display field
      * @since   1.2
      */
     add_action('woocommerce_product_bulk_edit_end', array($this, 'woocommerce_product_quick_edit_end_own'), 10);
     /**
      * Action - Bulk edit - Process Enable/Disable Offers on WooCommerce products save data
      * @since   1.2
      */
     add_action('woocommerce_product_bulk_edit_save', array($this, 'woocommerce_product_quick_edit_save_own'), 10, 1);
     /**
      * @since   1.2
      * Add jquery thinkbox in footer area
      */
     add_action('in_admin_footer', array($this, 'my_admin_footer_function'));
     add_action('offers_for_woocommerce_setting_tab', array($this, 'offers_for_woocommerce_setting_tab_own'));
     add_action('offers_for_woocommerce_setting_tab_content', array($this, 'offers_for_woocommerce_setting_tab_content_own'));
     add_action('offers_for_woocommerce_setting_tab_content_save', array($this, 'offers_for_woocommerce_setting_tab_content_save_own'));
     /**
      * END - custom functions
      */
 }
 public function __construct()
 {
     $plugin = Angelleye_Offers_For_Woocommerce::get_instance();
     $this->plugin_slug = $plugin->get_plugin_slug();
 }
 /**
  * Return an instance of this class
  *
  * @since    0.1.0
  *
  * @return    object    A single instance of this class
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }