'API', 'Faq' => 'FAQ', 'Url' => 'URL', 'Html' => 'HTML', 'Css' => 'CSS', 'Php' => 'PHP', 'Json' => 'JSON', 'Xml' => 'XML', 'Sql' => 'SQL', ); foreach ( $abbreviations as $search => $replace ) { $title = preg_replace( '/\b' . $search . '\b/', $replace, $title ); } return $title; } /** * Get status badge HTML * * @since 1.0.0 * * @param string $status Status (never, pending, success, error). * @return string Badge HTML. */ function robotstxt_docmd_get_status_badge( $status ) { $badges = array( 'never' => array( 'class' => 'status-never', 'label' => __( 'Never Synced', 'robotstxt-documentation-markdown' ), ), 'pending' => array( 'class' => 'status-pending', 'label' => __( 'Syncing...', 'robotstxt-documentation-markdown' ), ), 'success' => array( 'class' => 'status-success', 'label' => __( 'Success', 'robotstxt-documentation-markdown' ), ), 'error' => array( 'class' => 'status-error', 'label' => __( 'Error', 'robotstxt-documentation-markdown' ), ), ); $badge = $badges[ $status ] ?? $badges['never']; return sprintf( '%s', esc_attr( $badge['class'] ), esc_html( $badge['label'] ) ); }