'on', 'say' => __( 'The site owner can see what the plugin does under Growth Combinator in wp-admin.', 'growth-combinator' ), ); } /** * The menu item, with the Growth Combinator mark (WordPress recolours an SVG icon to match the admin colour scheme). * * @return void */ public function menu() { $mark = ''; add_menu_page( __( 'Growth Combinator', 'growth-combinator' ), __( 'Growth Combinator', 'growth-combinator' ), 'manage_options', self::SLUG, array( $this, 'render' ), 'data:image/svg+xml;base64,' . base64_encode( $mark ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode -- WordPress's documented format for an SVG menu icon. 81 ); } /** * A "Status" link next to Deactivate on the Plugins screen. * * @param string[] $links The plugin's action links. * @return string[] */ public function action_links( $links ) { array_unshift( $links, '' . esc_html__( 'Status', 'growth-combinator' ) . '' ); return $links; } /** * The page's stylesheet, on this page only. * * @param string $hook The current admin page. * @return void */ public function styles( $hook ) { if ( 'toplevel_page_' . self::SLUG !== $hook ) { return; } wp_enqueue_style( 'growth-combinator-admin', plugins_url( 'assets/admin.css', GROWTH_COMBINATOR_FILE ), array(), GROWTH_COMBINATOR_VERSION ); } /** * Users who approved Studio's connection, with when Studio last used it. * * @return array */ private function connections() { if ( ! class_exists( '\WP_Application_Passwords' ) ) { return array(); } $out = array(); $users = get_users( array( 'meta_key' => '_application_passwords', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Only on this admin page, and only users who have application passwords. 'fields' => array( 'ID', 'user_login' ), ) ); foreach ( $users as $user ) { foreach ( \WP_Application_Passwords::get_user_application_passwords( $user->ID ) as $item ) { if ( self::APP_NAME === $item['name'] ) { $out[] = array( 'login' => $user->user_login, 'last_used' => empty( $item['last_used'] ) ? null : (int) $item['last_used'], ); } } } return $out; } /** * The page. * * @return void */ public function render() { if ( ! current_user_can( 'manage_options' ) ) { return; } $connections = $this->connections(); $states = array( 'on' => __( 'Working', 'growth-combinator' ), 'idle' => __( 'Not needed here', 'growth-combinator' ), 'off' => __( 'Needs attention', 'growth-combinator' ), ); ?>

<?php esc_attr_e( 'Growth Combinator', 'growth-combinator' ); ?>

    report(); ?>

post_id ) ); ?> /path ); ?>/ moved ); ?>

· gcombinator.co