'; public $warning = ''; public $danger = ''; /*public $success = array('#0a9581', 'dashicons dashicons-yes-alt'); public $warning = array('#f8b82d', "dashicons dashicons-warning"); public $danger = array("#f65021", " dashiconsdashicons-dismiss");*/ /** * Get Status Page Info * @return array */ public function get_status(){ // woo_feed_delete_cache_data( "woo_feed_status_page_info" ); $status = woo_feed_get_cached_data( 'woo_feed_status_page_info' ); if ( false === $status ) { $status = [ $this->woocommerce_version(), // WooCommerce Version $this->get_available_product_types(), $this->total_products(), // Count Total Products $this->product_per_batch(), // Product Per branch $this->product_query_type(), $this->default_customer_location(), $this->server_info(), $this->multi_language(), $this->multi_currency(), $this->wordpress_debug(), $this->wordpress_cron(), $this->upload_dir_writable(), $this->exclude_feed_caching(), $this->wordpress_multisite(), ]; $status = array_merge($status, $this->server_info()); woo_feed_set_cache_data('woo_feed_status_page_info', $status); // Cache::set( 'woo_feed_status_page_info', $status ); } return $status; } /** * Get CTX Feed Log. */ public function get_logs( ) { $fatal_errors = Woo_Feed_Log_Handler_File::get_log_file_path('woo-feed-fatal-errors'); if ( file_exists($fatal_errors) && $fatal_errors ) { return file_get_contents($fatal_errors); //phpcs:ignore } return "No Logs Found."; } /** * Get Wordpress.org plugin information. * * @param $slug * * @return false|mixed */ private function plugin_info( $slug ) { if ( empty($slug) ) { return false; } $args = (object) array( 'slug' => $slug, 'fields' => array( 'sections' => false, 'screenshots' => false, 'versions' => false, ), ); $request = array( 'action' => 'plugin_information', 'request' => serialize( $args), //phpcs:ignore ); $url = 'http://api.wordpress.org/plugins/info/1.0/'; $response = wp_remote_post( $url, array( 'body' => $request ) ); if ( is_wp_error($response) ) { return false; } return unserialize( $response['body']); //phpcs:ignore } /** * Check WordPress multisite status. */ private function wordpress_multisite( ) { $status = $this->success; $message = 'No'; if ( defined( 'WOO_FEED_PRO_VERSION' ) && is_multisite() ) { $message = "WordPress Multisite is enabled. If you have hosted your sites into subdomain like fr.example.com then you need a license for each site. If you have five subdomain then you need the Five site license."; } return [ 'label' => 'WordPress Multi Site', 'status' => $status, 'message' => $message, ]; } /** * Get WooCommerce Version Status. */ private function woocommerce_version( ) { $installed_version = (function_exists('WC')) ? WC()->version : '1.0.0'; $latest_version = $this->plugin_info('woocommerce'); if ( version_compare($installed_version,'3.0','<') ) { $status = $this->danger; $message = $installed_version." - You are using a old version of WooCommerce. To use our plugin your WooCommerce version should be 3.0 or later."; }elseif ( version_compare($latest_version->version,$installed_version,'>') ) { $status = $this->warning; $message = $installed_version." - You are not using the latest version of WooCommerce. Update WooCommerce plugin to its latest version: ".$latest_version->version; }else { $status = $this->success; $message = $installed_version." - You are using the latest version of WooCommerce."; } return [ 'label' => 'WooCommerce Version', 'status' => $status, 'message' => $message, ]; } /** * Get Multi Language Status. */ private function multi_language( ) { $status = $this->success; $message = "No"; $doc = ''; $multi_lang_plugin = ''; /** * polylang/polylang.php Polylang * polylang-pro/polylang.php Polylang Pro * gtranslate/gtranslate.php GTranslate * translatepress-multilingual/index.php TranslatePress - Multilingual * weglot/weglot.php Weglot Translate * google-language-translator/google-language-translator.php Google Language Translator * sitepress-multilingual-cms/sitepress.php WPML Multilingual CMS */ if ( is_plugin_active('sitepress-multilingual-cms/sitepress.php') ) { $multi_lang_plugin = 'WPML'; $doc = "

You can read this doc about: How to make feed for WPML languages?"; }elseif ( is_plugin_active("polylang/polylang.php") ) { $multi_lang_plugin = 'Polylang'; $doc = "

You can read this doc about: How to make feed for Polylang languages?"; }elseif ( is_plugin_active("polylang-pro/polylang.php") ) { $multi_lang_plugin = 'Polylang Pro'; $doc = "

You can read this doc about: How to make feed for Polylang languages?"; }elseif ( is_plugin_active('gtranslate/gtranslate.php') ) { $multi_lang_plugin = 'GTranslate'; }elseif ( is_plugin_active('translatepress-multilingual/index.php') ) { $multi_lang_plugin = 'TranslatePress - Multilingual'; }elseif ( is_plugin_active('weglot/weglot.php') ) { $multi_lang_plugin = 'Weglot Translate'; }elseif ( is_plugin_active('google-language-translator/google-language-translator.php') ) { $multi_lang_plugin = 'Google Language Translator'; } if ( ! empty($multi_lang_plugin) ) { if ( ! in_array($multi_lang_plugin,[ 'WPML', 'Polylang', 'Polylang Pro', 'TranslatePress - Multilingual' ],true) ) { $status = $this->warning; $message = "$multi_lang_plugin is not compatible for multi-language feed. You can not make feed for each language. Supported multi-language plugins are WPML & Polylang."; }elseif ( is_plugin_active('webappick-product-feed-for-woocommerce/woo-feed.php') ) { $status = $this->warning; $message = "You are using $multi_lang_plugin for multi language site. But the free version of this plugin is not compatible with $multi_lang_plugin. Using Woo Feed Pro you can make feed for each language."; $message .= $doc; }else { $message = "$multi_lang_plugin"; } } return [ 'label' => 'Multi Language Site', 'status' => $status, 'message' => $message, ]; } /** * Get Multi Currency Status. */ private function multi_currency( ) { $status = $this->success; $message = "No"; $free_version = is_plugin_active( 'webappick-product-feed-for-woocommerce/woo-feed.php' ); $supported_multi_currency = "Below Multi Currency Plugins are compatible with Woo Feed Pro. "; $supported_multi_currency .= "
"; $supported_multi_currency .= "