id; if ( 'plugins' !== $screen_id && 'plugins-network' !== $screen_id ) { return; } self::enqueue_assets(); self::render_popover(); } /** * Enqueue the JS and CSS assets and pass data to the script. * * @return void * * @since 5.6.2 */ private static function enqueue_assets() { $base_url = WSAL_BASE_URL . 'classes/FeedbackForm/'; \wp_enqueue_style( 'wsal-feedback-form-styles', $base_url . 'feedback-form.css', array(), WSAL_VERSION ); \wp_enqueue_script( 'wsal-feedback-form-scripts', $base_url . 'feedback-form.js', array( 'wp-i18n' ), WSAL_VERSION, true ); \wp_set_script_translations( 'wsal-feedback-form-scripts', 'wp-security-audit-log', WSAL_BASE_DIR . 'languages' ); \wp_localize_script( 'wsal-feedback-form-scripts', 'wsalFeedbackForm', array( 'remoteUrl' => self::REMOTE_URL, 'plugin' => 'wp-security-audit-log' . self::get_plugin_variant(), 'siteUrl' => \get_site_url(), ) ); } /** * Render the feedback popover HTML. * * @return void * * @since 5.6.2 */ private static function render_popover() { $reasons = array( array( 'id' => 'unexpected-behavior', 'label' => \__( 'The plugin isn\'t working, caused issues, or has a bug', 'wp-security-audit-log' ), 'feedback_placeholder' => \__( 'Can you briefly describe the issue?', 'wp-security-audit-log' ), 'feedback_type' => 'textarea', ), array( 'id' => 'found-better-plugin', 'label' => \__( 'I found a better alternative', 'wp-security-audit-log' ), 'feedback_placeholder' => \__( 'Which plugin did you switch to?', 'wp-security-audit-log' ), 'feedback_type' => 'text', ), array( 'id' => 'missing-feature', 'label' => \__( 'The plugin is missing a specific feature', 'wp-security-audit-log' ), 'feedback_placeholder' => \__( 'What feature were you looking for?', 'wp-security-audit-log' ), 'feedback_type' => 'textarea', ), array( 'id' => 'hard-to-understand', 'label' => \__( 'The plugin is too hard to set up or understand', 'wp-security-audit-log' ), 'feedback_placeholder' => \__( 'Can you tell us a bit more about this?', 'wp-security-audit-log' ), 'feedback_type' => 'text', ), array( 'id' => 'temporary-deactivation', 'label' => \__( 'This is a temporary deactivation', 'wp-security-audit-log' ), 'feedback_type' => false, 'feedback_placeholder' => false, ), ); shuffle( $reasons ); $reasons[] = array( 'id' => 'other', 'label' => \__( 'Other', 'wp-security-audit-log' ), 'feedback_placeholder' => false, 'feedback_type' => false, ); $logo_url = WSAL_BASE_URL . 'img/wp-activity-log-logo-full-colour-horiz-rgb.svg'; ?>