missing = array(); $this->missing_one = false; add_action( 'admin_notices', array( $this, 'missing_plugins_warning' ) ); add_action( 'plugins_loaded', array( $this, 'plugins_loaded_action' ), 999999 ); add_action( 'wpml_loaded', array( $this, 'missing_php_extensions' ) ); } private function check_required_plugins() { $this->missing = array(); $this->missing_one = false; if ( ! defined( 'ICL_SITEPRESS_VERSION' ) || ICL_PLUGIN_INACTIVE || version_compare( ICL_SITEPRESS_VERSION, '2.0.5', '<' ) ) { $this->missing['WPML'] = array( 'url' => 'http://wpml.org', 'slug' => 'sitepress-multilingual-cms' ); $this->missing_one = true; } } public function plugins_loaded_action() { $this->check_required_plugins(); if ( ! $this->missing_one ) { do_action( 'wpml_tm_has_requirements' ); } } public function missing_php_extensions() { $extensions = $this->get_current_php_extensions(); if ( ! defined( 'ICL_HIDE_TRANSLATION_SERVICES' ) || ! ICL_HIDE_TRANSLATION_SERVICES ) { $wpml_wp_api_check = new WPML_WP_API(); if ( count($extensions) > 0 && $wpml_wp_api_check->is_tm_page() ) { $already_saved_invalid_extensions = get_option( self::INVALID_PHP_EXTENSIONS_OPTION ); if ( ! $already_saved_invalid_extensions || $already_saved_invalid_extensions !== $extensions ) { ICL_AdminNotifier::add_message( $this->build_invalid_php_extensions_message_args( $extensions ) ); update_option( self::INVALID_PHP_EXTENSIONS_OPTION, $extensions ); } } else { ICL_AdminNotifier::remove_message_group('wpml-tm-requirements'); } } } private function build_invalid_php_extensions_message_args( array $extensions ) { $message = ''; $message .= '
'; $message .= __( 'WPML Translation Management requires the following PHP extensions and settings:', 'wpml-translation-management' ); $message .= '
'; $message .= '' . $id . '=' . $data['value'] . '
';
}
if ( 'extension' === $data['type'] ) {
$message .= $data['type_description'] . ': ' . $id . '';
}
$message .= '