get_results("SELECT * FROM ".$wpdb->prefix."woocommerce_attribute_taxonomies;"); if (isset($_SESSION['errors'])) self::$errors = $_SESSION['errors']; if (isset($_SESSION['messages'])) self::$messages = $_SESSION['messages']; unset($_SESSION['messages']); unset($_SESSION['errors']); // Hooks add_filter('wp_redirect', array(&$this, 'redirect'), 1, 2); } /** get */ public static function get() { if (!isset(self::$_instance)) { $c = __CLASS__; self::$_instance = new $c; } return self::$_instance; } /** * Get the plugin url * * @return string url */ public static function plugin_url() { if(self::$plugin_url) return self::$plugin_url; if (is_ssl()) : return self::$plugin_url = str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename( dirname(dirname(__FILE__))); else : return self::$plugin_url = WP_PLUGIN_URL . "/" . plugin_basename( dirname(dirname(__FILE__))); endif; } /** * Get the plugin path * * @return string url */ public static function plugin_path() { if(self::$plugin_path) return self::$plugin_path; return self::$plugin_path = WP_PLUGIN_DIR . "/" . plugin_basename( dirname(dirname(__FILE__))); } /** * Return the URL with https if SSL is on * * @return string url */ public static function force_ssl( $url ) { if (is_ssl()) $url = str_replace('http:', 'https:', $url); return $url; } /** * Get a var * * Variable is filtered by woocommerce_get_var_{var name} * * @param string var * @return string variable */ public static function get_var($var) { $return = ''; switch ($var) : case "version" : $return = WOOCOMMERCE_VERSION; break; case "shop_thumbnail_image_width" : $return = get_option('woocommerce_thumbnail_image_width'); break; case "shop_thumbnail_image_height" : $return = get_option('woocommerce_thumbnail_image_height'); break; case "shop_catalog_image_width" : $return = get_option('woocommerce_catalog_image_width'); break; case "shop_catalog_image_height" : $return = get_option('woocommerce_catalog_image_height'); break; case "shop_single_image_width" : $return = get_option('woocommerce_single_image_width'); break; case "shop_single_image_height" : $return = get_option('woocommerce_single_image_height'); break; endswitch; return apply_filters( 'woocommerce_get_var_'.$var, $return ); } /** * Add an error * * @param string error */ function add_error( $error ) { self::$errors[] = $error; } /** * Add a message * * @param string message */ function add_message( $message ) { self::$messages[] = $message; } /** Clear messages and errors from the session data */ function clear_messages() { self::$errors = self::$messages = array(); unset($_SESSION['messages']); unset($_SESSION['errors']); } /** * Get error count * * @return int */ function error_count() { return sizeof(self::$errors); } /** * Get message count * * @return int */ function message_count() { return sizeof(self::$messages); } /** * Output the errors and messages * * @return bool */ public static function show_messages() { if (isset(self::$errors) && sizeof(self::$errors)>0) : echo '