private function missing_php_extensions() { $extensions = array(); if (ini_get('allow_url_fopen') !== '1') { $extensions['allow_url_fopen'] = array('type' => 'setting', 'type_description' => __('PHP Setting', 'wpml-translation-management'), 'value' => '1'); } if (!extension_loaded('openssl')) { $extensions['openssl'] = array('type' => 'extension', 'type_description' => __('PHP Extension', 'wpml-translation-management')); } if (class_exists('ICL_AdminNotifier') && (!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()) { $message = ''; $message .= '<p>'; $message .= __('WPML Translation Management requires the following PHP extensions and settings:', 'wpml-translation-management'); $message .= '</p>'; $message .= '<ul>'; foreach ($extensions as $id => $data) { $message .= '<li>'; if ('setting' === $data['type']) { $message .= $data['type_description'] . ': <code>' . $id . '=' . $data['value'] . '</code>'; } if ('extension' === $data['type']) { $message .= $data['type_description'] . ': <strong>' . $id . '</strong>'; } $message .= '</li>'; } $message .= '</ul>'; $args = array('id' => 'wpml-tm-missing-extensions', 'group' => 'wpml-tm-requirements', 'msg' => $message, 'type' => 'error', 'admin_notice' => true, 'hide' => true); ICL_AdminNotifier::add_message($args); } else { ICL_AdminNotifier::remove_message_group('wpml-tm-requirements'); } } }
public function promote_wcml_message() { $promote = false; if (class_exists('WooCommerce') && !class_exists('woocommerce_wpml')) { global $pagenow; $promote = $this->wpml_wp_api->is_tm_page(); if (isset($_GET['post_type']) && !empty($_GET['post_type'])) { $promote = 'product' === $_GET['post_type'] && 'edit.php' === $pagenow; } } if ($promote) { $message = ''; $wcml_link = '<a href="https://wordpress.org/plugins/woocommerce-multilingual" target="_blank">WooCommerce Multilingual.</a>'; $message .= sprintf(__('Looks like you are running a multilingual WooCommerce site. To easily translate WooCommerce products and categories, you should use %s', 'wpml-translation-management'), $wcml_link); $args = array('id' => 'promote-wcml', 'group' => 'promote-wcml', 'msg' => $message, 'type' => 'notice', 'admin_notice' => true, 'hide' => true); ICL_AdminNotifier::add_message($args); } else { ICL_AdminNotifier::remove_message_group('promote-wcml'); } }
/** * Register notification with number of items in basket and link to basket */ public static function update_basket_notifications() { $positions = self::get_basket_notification_positions(); $basket_link = "admin.php?page=" . WPML_TM_FOLDER . "/menu/main.php&sm=basket"; foreach ($positions as $position => $group) { ICL_AdminNotifier::remove_message_group($position); } self::get_basket(); $basket_items_count = self::get_basket_items_count(true); // if we have something in the basket if ($basket_items_count > 0 && (!isset($_GET['clear_basket']) || $_GET['clear_basket'] != 1) && (!isset($_GET['action']) || $_GET['action'] != 'delete')) { $text = __('The items you have selected are now in the translation basket –', 'wpml-translation-management'); $text .= ' ' . sprintf(__('<a href="%s">Send to translation »</a>', 'wpml-translation-management'), $basket_link); // translation management pages $message_args = array('id' => $positions['tm_dashboard_top'], 'text' => $text, 'classes' => 'small', 'type' => 'information small', 'group' => $positions['tm_dashboard_top'], 'admin_notice' => false, 'hide_per_user' => false, 'dismiss_per_user' => false, 'capability' => 'manage_options'); ICL_AdminNotifier::add_message($message_args); } else { ICL_AdminNotifier::remove_message($positions['tm_dashboard_top']); } $admin_basket_message_id = $positions['admin_notice']; if (self::$messages || $basket_items_count > 0) { $additional_messages = array(); if (isset(self::$messages) && is_array(self::$messages)) { foreach (self::$messages as $message) { $additional_messages[] = $message['text']; } } $additional_messages_text = ''; if (count($additional_messages) > 0) { $additional_messages_text = '<ul><li>' . implode('</li><li>', $additional_messages) . '</li></ul>'; } $limit_to_page = array(); $limit_to_page[] = WPML_TM_FOLDER . '/menu/main.php'; $message_args = array('id' => $admin_basket_message_id, 'text' => $additional_messages_text, 'classes' => 'small', 'type' => 'information', 'group' => $admin_basket_message_id, 'admin_notice' => true, 'hide_per_user' => false, 'dismiss_per_user' => false, 'limit_to_page' => $limit_to_page, 'show_once' => true); if (trim($additional_messages_text) != '') { ICL_AdminNotifier::add_message($message_args); } } else { ICL_AdminNotifier::remove_message($admin_basket_message_id); } }