ID : (int) $user; return $id ? SP_Identity::address_of( $id ) : ''; } /** * Whether this installation can do wallet cryptography at all. * * Checked on activation and shown as an admin notice rather than left to * surface as a fatal during someone's first login attempt. * * @return string '' when fine, otherwise what is missing. */ function sirius_press_requirements_problem() { if ( ! SP_BN::available() ) { return __( 'Sirius Press needs either the GMP or the BCMath PHP extension to verify wallet signatures. Ask your host to enable one — GMP is much faster.', 'sirius-press' ); } if ( PHP_INT_SIZE < 8 ) { return __( 'Sirius Press needs 64-bit PHP. Address checksums cannot be computed on a 32-bit build.', 'sirius-press' ); } if ( ! function_exists( 'openssl_encrypt' ) ) { return __( 'Sirius Press needs the OpenSSL PHP extension to store a publishing key safely.', 'sirius-press' ); } return ''; } register_activation_hook( __FILE__, function () { SP_Inbox::install(); } ); add_action( 'plugins_loaded', function () { if ( (int) get_option( 'sirius_press_inbox_version', 0 ) < SP_Inbox::VERSION ) { SP_Inbox::install(); } SP_Identity::hooks(); SP_Inbox::hooks(); SP_Admin::hooks(); } ); /* * Translations load on `init`, not `plugins_loaded`. WordPress 6.7 started * warning about the earlier hook because the locale is not settled yet, and a * notice on every request is the kind of thing that trains people to ignore * their logs. */ add_action( 'init', function () { load_plugin_textdomain( 'sirius-press', false, dirname( plugin_basename( SIRIUS_PRESS_CORE_FILE ) ) . '/languages' ); } ); add_action( 'admin_notices', function () { if ( ! current_user_can( 'manage_options' ) ) { return; } $problem = sirius_press_requirements_problem(); if ( '' !== $problem ) { printf( '

%s

', esc_html( $problem ) ); return; } if ( ! SP_Settings::is_configured() ) { printf( '

%s %s

', esc_html__( 'Sirius Press does not know which BCNR name this site publishes under yet.', 'sirius-press' ), esc_url( admin_url( 'admin.php?page=sirius-press' ) ), esc_html__( 'Set it now', 'sirius-press' ) ); } } );