showError( __( 'All Countries Counties For WooCommerce is enabled but not effective. It requires WooCommerce in order to work. Kindly Install/Activate WooCommerce.', 'all-countries-counties-for-wc' ) ); return false; } } /** * @param $states * @return mixed */ public function wc_add_counties($states ) { $allowed_countries = $this->get_store_allowed_countries(); if ( ! empty( $allowed_countries ) ) { foreach ($allowed_countries as $code => $country) { if (file_exists($this->plugin_path() . '/states/' . $code . '.php')) { include($this->plugin_path() . '/states/' . $code . '.php'); } } } return $states; } /** * @return array */ public function get_store_allowed_countries() { $allowed_countries = new WC_Countries(); return array_merge( $allowed_countries->get_allowed_countries(), $allowed_countries->get_shipping_countries() ); } /** * @return mixed */ public function plugin_path() { return untrailingslashit( plugin_dir_path( __FILE__ ) ); } /** * Output notice * * @param string $message * @param bool $success */ public function outputNotice( $message, $success = true ) { echo '
' . $message . '