mpare( $premium_version, '28.1-RC0', '>' ); } /** * Returns the one-click Premium update URL for the current user, or an empty string when the user * lacks the `update_plugins` capability (and would hit a wp_die permission error on update.php). * * @return string The nonce-protected update URL, or an empty string. */ private function get_premium_update_url(): string { if ( ! \current_user_can( 'update_plugins' ) ) { return ''; } return \html_entity_decode( \wp_nonce_url( \self_admin_url( 'update.php?action=upgrade-plugin&plugin=wordpress-seo-premium%2Fwp-seo-premium.php' ), 'upgrade-plugin_wordpress-seo-premium/wp-seo-premium.php', ), \ENT_COMPAT, ); } /** * Returns the selection carried over from a post overview bulk action, if any. * * The parameters only decide which rows start out selected in the app; the REST endpoints * enforce the actual per-post edit access when anything is saved. * * @param array> $content_types The available content types. * * @return array> The content type, post IDs and overview selection count. */ private function get_initial_selection( array $content_types ): array { $initial_selection = [ 'contentType' => '', 'postIds' => [], 'selectedCount' => 0, ]; // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Reason: read-only display state, no action is taken. if ( ! isset( $_GET[ self::CONTENT_TYPE_PARAM ] ) || ! \is_string( $_GET[ self::CONTENT_TYPE_PARAM ] ) ) { return $initial_selection; } $content_type = \sanitize_text_field( \wp_unslash( $_GET[ self::CONTENT_TYPE_PARAM ] ) ); if ( ! \in_array( $content_type, \array_column( $content_types, 'name' ), true ) ) { return $initial_selection; } $initial_selection['contentType'] = $content_type; if ( isset( $_GET[ self::POST_IDS_PARAM ] ) && \is_string( $_GET[ self::POST_IDS_PARAM ] ) ) { $post_ids = \explode( ',', \sanitize_text_field( \wp_unslash( $_GET[ self::POST_IDS_PARAM ] ) ) ); $post_ids = \array_values( \array_unique( \array_filter( \array_map( 'intval', $post_ids ), static function ( $id ) { return $id > 0; }, ), ), ); $post_ids = \array_slice( $post_ids, 0, Batch_Limit::MAX_ITEMS ); $initial_selection['postIds'] = $post_ids; $initial_selection['selectedCount'] = \count( $post_ids ); } if ( $initial_selection['postIds'] !== [] && isset( $_GET[ self::SELECTED_COUNT_PARAM ] ) && \is_string( $_GET[ self::SELECTED_COUNT_PARAM ] ) ) { // The count can only grow beyond the carried IDs, never shrink below them. $initial_selection['selectedCount'] = \max( $initial_selection['selectedCount'], \absint( \wp_unslash( $_GET[ self::SELECTED_COUNT_PARAM ] ) ), ); } // phpcs:enable WordPress.Security.NonceVerification.Recommended return $initial_selection; } /** * Registers the carried-over selection parameters as removable, so WordPress cleans them from the * address bar once the page has picked them up. * * @param array $removable_query_args The removable query args. * * @return array The removable query args. */ public function add_removable_query_args( $removable_query_args ) { $removable_query_args[] = self::POST_IDS_PARAM; $removable_query_args[] = self::SELECTED_COUNT_PARAM; return $removable_query_args; } /** * Gets whether the bulk editor guided tour has been seen by the current user. * * @return bool True when the tour has been seen, false otherwise. */ private function is_tour_opt_in_notification_seen(): bool { $current_user_id = $this->user_helper->get_current_user_id(); return (bool) $this->user_helper->get_meta( $current_user_id, '_yoast_wpseo_bulk_editor_tour_opt_in_notification_seen', true ); } /** * Returns the tags of all registered shortcodes. * * Mirrors what the post editor passes to the analysis (see WPSEO_Metabox::get_valid_shortcode_tags()), so the * parse tree treats shortcodes the same on both pages: the delimiters are removed and the text an enclosing * shortcode wraps is kept. Without this list the raw brackets stay in the text and consume prompt tokens. * * @return array The registered shortcode tags. */ private function get_valid_shortcode_tags(): array { // The global is always set by WordPress, but stay defensive: an empty list only costs shortcode parity. if ( ! isset( $GLOBALS['shortcode_tags'] ) || ! \is_array( $GLOBALS['shortcode_tags'] ) ) { return []; } return \array_keys( $GLOBALS['shortcode_tags'] ); } /** * Removes all current WP notices. * * @return void */ public function remove_notices() { \remove_all_actions( 'admin_notices' ); \remove_all_actions( 'user_admin_notices' ); \remove_all_actions( 'network_admin_notices' ); \remove_all_actions( 'all_admin_notices' ); } } kentucky fried chicken Archives - Business Franchise
- kentucky fried chicken