Short slug => user meta key. */ private static function optional_notice_dismiss_meta_map() { return array( 'miv' => self::USER_META_DISMISS_MIV, 'uploads' => self::USER_META_DISMISS_UPLOADS, 'critical' => self::USER_META_DISMISS_CRITICAL, 'updir' => self::USER_META_DISMISS_UPLOAD_DIR, ); } /** * Permanently hide optional notices per user. */ public static function handle_optional_notice_dismiss() { if ( ! is_admin() || ! isset( $_GET['tf_status_dismiss'], $_GET['_wpnonce'] ) || ! current_user_can( 'manage_options' ) ) { return; } $key = sanitize_key( wp_unslash( $_GET['tf_status_dismiss'] ) ); $map = self::optional_notice_dismiss_meta_map(); if ( ! isset( $map[ $key ] ) ) { return; } $action = 'tf_status_dismiss_' . $key; if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), $action ) ) { return; } update_user_meta( get_current_user_id(), $map[ $key ], '1' ); $redirect = wp_get_referer(); if ( ! $redirect ) { $redirect = admin_url(); } $redirect = remove_query_arg( array( 'tf_status_dismiss', '_wpnonce' ), $redirect ); wp_safe_redirect( $redirect ); exit; } /** * @param string $meta_key self::USER_META_* constant. */ private static function is_optional_notice_dismissed( $meta_key ) { return (string) get_user_meta( get_current_user_id(), $meta_key, true ) === '1'; } /** * @param string $dismiss_key Short key from optional_notice_dismiss_meta_map(). */ public static function get_optional_notice_dismiss_url( $dismiss_key ) { $map = self::optional_notice_dismiss_meta_map(); if ( ! isset( $map[ $dismiss_key ] ) ) { return ''; } $url = add_query_arg( 'tf_status_dismiss', $dismiss_key, self_admin_url( 'index.php' ) ); return wp_nonce_url( $url, 'tf_status_dismiss_' . $dismiss_key ); } /** * Whether this optional notice was dismissed for the current user. * * @param string $dismiss_key Short slug (e.g. updir, uploads). */ public static function is_optional_notice_dismissed_for_key( $dismiss_key ) { $map = self::optional_notice_dismiss_meta_map(); return isset( $map[ $dismiss_key ] ) && self::is_optional_notice_dismissed( $map[ $dismiss_key ] ); } /** * Scoped dismiss-link spacing on any admin screen that shows Themify notices. */ public static function print_notice_dismiss_styles() { if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) { return; } echo ''; } /** * Neither fsockopen nor cURL — HTTP to external services may fail (same check as System Status). */ public static function is_fsockopen_and_curl_unavailable() { return ! ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ); } /** * No WP image editor (GD / Imagick) available. */ public static function is_wp_image_editor_unavailable() { if ( ! function_exists( '_wp_image_editor_choose' ) && defined( 'ABSPATH' ) ) { $media = ABSPATH . 'wp-includes/media.php'; if ( is_readable( $media ) ) { require_once $media; } } if ( ! function_exists( '_wp_image_editor_choose' ) ) { return true; } return empty( _wp_image_editor_choose() ); } /** * TF storage table could not be created (same check as "Custom Tables Allowed" on System Status). */ public static function is_themify_custom_tables_unavailable() { if ( ! class_exists( 'Themify_Storage', false ) ) { return true; } return Themify_Storage::init() === false; } /** * @return bool True when max_input_vars is set and below 1000 (WordPress / large forms often need 1000+). */ public static function is_max_input_vars_low() { if ( ! function_exists( 'ini_get' ) ) { return false; } $v = (int) ini_get( 'max_input_vars' ); return $v > 0 && $v < 1000; } /** * @return bool True when PHP is below 8.2 (Themify recommends 8.2+; same as System Status notice). */ public static function is_php_below_82() { return version_compare( PHP_VERSION, '8.2', '<' ); } public static function critical_requirements_admin_notice() { if ( ! is_admin() || ! current_user_can( 'manage_options' ) || self::is_optional_notice_dismissed( self::USER_META_DISMISS_CRITICAL ) ) { return; } $items = array(); if ( self::is_themify_custom_tables_unavailable() ) { $items[] = esc_html__( 'The theme could not create its custom database table (caching and some features that depend on it may not work).', 'themify' ); } if ( self::is_fsockopen_and_curl_unavailable() ) { $items[] = esc_html__( 'Neither fsockopen nor cURL is available, so the site may not be able to connect to external services.', 'themify' ); } if ( self::is_wp_image_editor_unavailable() ) { $items[] = esc_html__( 'No image processing library (such as GD or Imagick) is available, so image editing and thumbnail generation can fail.', 'themify' ); } if ( empty( $items ) ) { return; } $url = admin_url( 'admin.php?page=tf-status' ); $link = '' . esc_html__( 'System Status', 'themify' ) . ''; $intro = esc_html__( 'Themify: your server is missing one or more critical requirements.', 'themify' ); ?>
' . esc_html__( 'System Status', 'themify' ) . ''; ?>max_input_vars is low (%1$d). Large pages or the Builder can fail to save. Increase it (often to 2000 or more) in your PHP configuration, or see %2$s for context.', 'themify' ), (int) ini_get( 'max_input_vars' ), $link ), array( 'a' => array( 'href' => array() ), 'code' => array() ) ); ?>
' . esc_html__( 'System Status', 'themify' ) . ''; echo wp_kses( /* translators: %s: "System Status" link. */ sprintf( __( 'Themify: the "uploads" folder is not write-able (the theme might not able to generate the styling). View %s for more details.', 'themify' ), $link ), array( 'a' => array( 'href' => array() ) ) ); ?>
| : | ', __( 'Cannot be determined.', 'themify' ); } ?> | ||
|---|---|---|---|
| : |
: |
||
| : | ' . esc_html__( 'We recommend using PHP version 8.2 or above for greater performance and security. Please contact your web hosting provider.', 'themify' ); } ?> | ||
| : |
';
} else {
echo ' ' . esc_html__( 'Use a full https:// site URL in Settings → General when your site is served over SSL. Plain http or relative URLs can cause mixed-content and asset issues.', 'themify' ) . ' '; } echo esc_html( $tf_home !== '' ? $tf_home : __( '(not set)', 'themify' ) ); ?> |
||
| : | |||
| : | db_server_info(); ?> | ||
| : | |||
| : | |||
| : | |||
| : |
WP_MEMORY_LIMIT: ' . esc_html( $tf_wp_mem_fmt ) . ' '; } else { echo 'WP_MEMORY_LIMIT: ' . esc_html( $tf_wp_mem_fmt ) . ' '; } ?> : |
||
| : | ' . esc_html__( 'Value is below 1000. WordPress, large menus, and the Builder can exceed this. Ask your host to raise max_input_vars (2000+ is often used).', 'themify' ) . ''; } ?> | ||
| : | |||
| : | ' : '–'; ?> | ||
| : | |||
| : | '; } else { echo ' ' . esc_html__( 'Your server does not have fsockopen or cURL enabled - some features that require connecting to external web services may not work. Contact your hosting provider.', 'themify' ) . ''; } ?> | ||
| : | '; } else { echo ' ' . esc_html__( 'Your server does not have have permissions to create custom tables in DB', 'themify' ) . ''; } ?> | ||
| : | ' . $gzip['f']; } else { echo ' ' . sprintf( __( 'GZIP is recommended for better performance.', 'themify' ), 'https://php.net/manual/en/zlib.installation.php' ) . ''; } ?> | ||
| : | ' : ' ' . sprintf( __( 'PHP Zip extension is recommended, this enables export/import of various data (settings, Builder content, etc.).', 'themify' ), 'https://www.php.net/manual/en/zip.setup.php' ) . ''; ?> | ||
| : | '; } else { /* Translators: %s: classname and link. */ echo ' ' . sprintf( esc_html__( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'themify' ), 'mbstring' ) . ''; } ?> | ||
| : |
' . __( 'Base Dir ', 'themify' ) . ': ' . $dir['basedir'] . ' ' . '' . __( 'Base URL ', 'themify' ) . ': ' . $dir['baseurl'] . ''; if ( strpos( $dir['baseurl'], 'http' ) === false ) { echo ' ' . sprintf( __( 'Relative paths detected. URLs should be full paths. Assets may not load properly.', 'themify' ), 'https://developer.wordpress.org/plugins/plugin-basics/determining-plugin-and-content-directories/#constants' ) . ''; } ?> |
||
| : | '; } else { echo ' ' . esc_html__( 'Uploads folder is not writeable, your CSS may not display correctly.', 'themify' ) . ''; } ?> | ||
| : | ' . esc_html__( 'No image processing library found. Please contact your web hosting to enable this.', 'themify' ) . ''; } else { echo '' . esc_html( _wp_image_editor_choose() ); } ?> | ||
| : | db_version();?> | ||
| : |
get_var("SELECT @@character_set_database");
?>
:
: get_var("SELECT @@collation_database") ); ?> |
||
| : |
|
||
| : | |||