Making WordPress.org

Ticket #1573: 1573.diff

File 1573.diff, 30.2 KB (added by obenland, 9 years ago)
  • wp-content/plugins/plugin-directory/cli/class-import.php

     
    7878                        $status = 'disabled';
    7979                }
    8080
    81                 if ( ! $plugin ) {                     
     81                if ( ! $plugin ) {
    8282                        $plugin = Plugin_Directory::create_plugin_post( array(
    8383                                'slug' => $plugin_slug,
    8484                                'status' => $status,
     
    131131                wp_update_post( $plugin );
    132132                remove_filter( 'wp_insert_post_data', array( $this, 'filter_wp_insert_post_data' ) );
    133133
     134                wp_set_post_terms( $plugin->ID, Tag_To_Category::map( $readme->tags ), 'plugin_category' );
     135
    134136                foreach ( $this->readme_fields as $readme_field ) {
    135137                        // Don't change the tested version if a newer version was specified through wp-admin
    136138                        if ( 'tested' == $readme_field && version_compare( get_post_meta( $plugin->ID, 'tested', true ), $readme->$readme_field, '>' ) ) {
  • wp-content/plugins/plugin-directory/cli/class-tag-to-category.php

     
     1<?php
     2namespace WordPressdotorg\Plugin_Directory\CLI;
     3
     4/**
     5 * The functionality to map tags to Plugin Categories.
     6 *
     7 * @package WordPressdotorg\Plugin_Directory\CLI
     8 */
     9class Tag_To_Category {
     10
     11        /**
     12         * @static
     13         *
     14         * @var array
     15         */
     16        public static $map = array(
     17                'accessibility'              => 'accessibility',
     18                'accessible'                 => 'accessibility',
     19                'ads'                        => 'advertising',
     20                'affiliate'                  => 'advertising',
     21                'advertising'                => 'advertising',
     22                'adsense'                    => 'advertising',
     23                'ad'                         => 'advertising',
     24                'advertisement'              => 'advertising',
     25                'monetization'               => 'advertising',
     26                'affiliates'                 => 'advertising',
     27                'affiliate-marketing'        => 'advertising',
     28                'google-adsense'             => 'advertising',
     29                'advertise'                  => 'advertising',
     30                'analytics'                  => 'analytics',
     31                'stats'                      => 'analytics',
     32                'statistics'                 => 'analytics',
     33                'tracking'                   => 'analytics',
     34                'google-analytics'           => 'analytics',
     35                'counter'                    => 'analytics',
     36                'visits'                     => 'analytics',
     37                'referrer'                   => 'analytics',
     38                'hits'                       => 'analytics',
     39                'statistic'                  => 'analytics',
     40                'stat'                       => 'analytics',
     41                'sports'                     => 'arts-and-entertainment',
     42                'games'                      => 'arts-and-entertainment',
     43                'football'                   => 'arts-and-entertainment',
     44                'game'                       => 'arts-and-entertainment',
     45                'soccer'                     => 'arts-and-entertainment',
     46                'movies'                     => 'arts-and-entertainment',
     47                'christmas'                  => 'arts-and-entertainment',
     48                'sport'                      => 'arts-and-entertainment',
     49                'login'                      => 'authentication',
     50                'authentication'             => 'authentication',
     51                'register'                   => 'authentication',
     52                'recaptcha'                  => 'authentication',
     53                'oauth'                      => 'authentication',
     54                'logout'                     => 'authentication',
     55                'custom-login'               => 'authentication',
     56                'username'                   => 'authentication',
     57                'wp-login'                   => 'authentication',
     58                'auth'                       => 'authentication',
     59                'openid'                     => 'authentication',
     60                'real-estate'                => 'business',
     61                'business'                   => 'business',
     62                'travel'                     => 'business',
     63                'restaurant'                 => 'business',
     64                'food'                       => 'business',
     65                'jobs'                       => 'business',
     66                'church'                     => 'business',
     67                'idx'                        => 'business',
     68                'events'                     => 'calendar-and-events',
     69                'calendar'                   => 'calendar-and-events',
     70                'event'                      => 'calendar-and-events',
     71                'schedule'                   => 'calendar-and-events',
     72                'booking'                    => 'calendar-and-events',
     73                'countdown'                  => 'calendar-and-events',
     74                'scheduling'                 => 'calendar-and-events',
     75                'event-calendar'             => 'calendar-and-events',
     76                'booking-calendar'           => 'calendar-and-events',
     77                'ticketing'                  => 'calendar-and-events',
     78                'clock'                      => 'calendar-and-events',
     79                'appointment'                => 'calendar-and-events',
     80                'event-management'           => 'calendar-and-events',
     81                'events-calendar'            => 'calendar-and-events',
     82                'dates'                      => 'calendar-and-events',
     83                'bookings'                   => 'calendar-and-events',
     84                'meeting'                    => 'calendar-and-events',
     85                'conference'                 => 'calendar-and-events',
     86                'availability-calendar'      => 'calendar-and-events',
     87                'booking-system'             => 'calendar-and-events',
     88                'email'                      => 'communication',
     89                'mail'                       => 'communication',
     90                'chat'                       => 'communication',
     91                'subscribe'                  => 'communication',
     92                'subscription'               => 'communication',
     93                'mailchimp'                  => 'communication',
     94                'email-marketing'            => 'communication',
     95                'message'                    => 'communication',
     96                'live-chat'                  => 'communication',
     97                'sms'                        => 'communication',
     98                'mailing-list'               => 'communication',
     99                'subscribers'                => 'communication',
     100                'e-mail'                     => 'communication',
     101                'smtp'                       => 'communication',
     102                'aweber'                     => 'communication',
     103                'email-form'                 => 'communication',
     104                'livechat'                   => 'communication',
     105                'subscriptions'              => 'communication',
     106                'newsletters'                => 'communication',
     107                'gmail'                      => 'communication',
     108                'messaging'                  => 'communication',
     109                'wp_mail'                    => 'communication',
     110                'online-chat'                => 'communication',
     111                'emails'                     => 'communication',
     112                'messages'                   => 'communication',
     113                'live-chat-software'         => 'communication',
     114                'subscriber'                 => 'communication',
     115                'wordpress-chat'             => 'communication',
     116                'free-chat'                  => 'communication',
     117                'magazine'                   => 'communication',
     118                'chat-online'                => 'communication',
     119                'form'                       => 'contact-forms',
     120                'contact-form'               => 'contact-forms',
     121                'contact'                    => 'contact-forms',
     122                'newsletter'                 => 'contact-forms',
     123                'forms'                      => 'contact-forms',
     124                'feedback'                   => 'contact-forms',
     125                'contact-form-7'             => 'contact-forms',
     126                'gravity-forms'              => 'contact-forms',
     127                'survey'                     => 'contact-forms',
     128                'form-builder'               => 'contact-forms',
     129                'contact-us'                 => 'contact-forms',
     130                'contact-forms'              => 'contact-forms',
     131                'contact-form-plugin'        => 'contact-forms',
     132                'cf7'                        => 'contact-forms',
     133                'feedback-form'              => 'contact-forms',
     134                'gravityforms'               => 'contact-forms',
     135                'gravity'                    => 'contact-forms',
     136                'widget'                     => 'customization',
     137                'shortcode'                  => 'customization',
     138                'sidebar'                    => 'customization',
     139                'widgets'                    => 'customization',
     140                'menu'                       => 'customization',
     141                'navigation'                 => 'customization',
     142                'shortcodes'                 => 'customization',
     143                'profile'                    => 'customization',
     144                'template'                   => 'customization',
     145                'themes'                     => 'customization',
     146                'customize'                  => 'customization',
     147                'portfolio'                  => 'customization',
     148                'genesis'                    => 'customization',
     149                'menus'                      => 'customization',
     150                'customizer'                 => 'customization',
     151                'accordion'                  => 'customization',
     152                'templates'                  => 'customization',
     153                'woothemes'                  => 'customization',
     154                'customization'              => 'customization',
     155                'genesiswp'                  => 'customization',
     156                'sidebars'                   => 'customization',
     157                'short-code'                 => 'customization',
     158                'customizable'               => 'customization',
     159                'font-awesome'               => 'customization',
     160                'page-builder'               => 'customization',
     161                'studiopress'                => 'customization',
     162                'configurable'               => 'customization',
     163                'typography'                 => 'customization',
     164                'sidebar-widget'             => 'customization',
     165                'comments'                   => 'discussions-and-community',
     166                'buddypress'                 => 'discussions-and-community',
     167                'comment'                    => 'discussions-and-community',
     168                'captcha'                    => 'discussions-and-community',
     169                'bbpress'                    => 'discussions-and-community',
     170                'community'                  => 'discussions-and-community',
     171                'avatar'                     => 'discussions-and-community',
     172                'forum'                      => 'discussions-and-community',
     173                'groups'                     => 'discussions-and-community',
     174                'gravatar'                   => 'discussions-and-community',
     175                'profiles'                   => 'discussions-and-community',
     176                'forums'                     => 'discussions-and-community',
     177                'discussion'                 => 'discussions-and-community',
     178                'moderation'                 => 'discussions-and-community',
     179                'trackback'                  => 'discussions-and-community',
     180                'pingback'                   => 'discussions-and-community',
     181                'disqus'                     => 'discussions-and-community',
     182                'commenting'                 => 'discussions-and-community',
     183                'woocommerce'                => 'ecommerce',
     184                'ecommerce'                  => 'ecommerce',
     185                'e-commerce'                 => 'ecommerce',
     186                'shop'                       => 'ecommerce',
     187                'paypal'                     => 'ecommerce',
     188                'payment'                    => 'ecommerce',
     189                'store'                      => 'ecommerce',
     190                'amazon'                     => 'ecommerce',
     191                'products'                   => 'ecommerce',
     192                'cart'                       => 'ecommerce',
     193                'payment-gateway'            => 'ecommerce',
     194                'commerce'                   => 'ecommerce',
     195                'sales'                      => 'ecommerce',
     196                'shipping'                   => 'ecommerce',
     197                'checkout'                   => 'ecommerce',
     198                'shopping'                   => 'ecommerce',
     199                'shopping-cart'              => 'ecommerce',
     200                'sell'                       => 'ecommerce',
     201                'money'                      => 'ecommerce',
     202                'wp-e-commerce'              => 'ecommerce',
     203                'easy-digital-downloads'     => 'ecommerce',
     204                'wordpress-ecommerce'        => 'ecommerce',
     205                'edd'                        => 'ecommerce',
     206                'monetize'                   => 'ecommerce',
     207                'donate'                     => 'ecommerce',
     208                'payments'                   => 'ecommerce',
     209                'donation'                   => 'ecommerce',
     210                'revenue'                    => 'ecommerce',
     211                'donations'                  => 'ecommerce',
     212                'bitcoin'                    => 'ecommerce',
     213                'make-money'                 => 'ecommerce',
     214                'tax'                        => 'ecommerce',
     215                'price'                      => 'ecommerce',
     216                'digital-downloads'          => 'ecommerce',
     217                'coupon'                     => 'ecommerce',
     218                'currency'                   => 'ecommerce',
     219                'inventory'                  => 'ecommerce',
     220                'wp-ecommerce'               => 'ecommerce',
     221                'credit-card'                => 'ecommerce',
     222                'stripe'                     => 'ecommerce',
     223                'eshop'                      => 'ecommerce',
     224                'coupons'                    => 'ecommerce',
     225                'selling'                    => 'ecommerce',
     226                'online-store'               => 'ecommerce',
     227                'discount'                   => 'ecommerce',
     228                'earn-money'                 => 'ecommerce',
     229                'campaign'                   => 'ecommerce',
     230                'woo-commerce'               => 'ecommerce',
     231                'charity'                    => 'ecommerce',
     232                'ebay'                       => 'ecommerce',
     233                'woo'                        => 'ecommerce',
     234                'billing'                    => 'ecommerce',
     235                'fundraising'                => 'ecommerce',
     236                'invoice'                    => 'ecommerce',
     237                'jigoshop'                   => 'ecommerce',
     238                'shopp'                      => 'ecommerce',
     239                'e-downloads'                => 'ecommerce',
     240                'editor'                     => 'editor-and-writing',
     241                'tinymce'                    => 'editor-and-writing',
     242                'formatting'                 => 'editor-and-writing',
     243                'wysiwyg'                    => 'editor-and-writing',
     244                'visual-editor'              => 'editor-and-writing',
     245                'writing'                    => 'editor-and-writing',
     246                'editing'                    => 'editor-and-writing',
     247                'customer-support'           => 'education-and-support',
     248                'education'                  => 'education-and-support',
     249                'live-support'               => 'education-and-support',
     250                'helpdesk'                   => 'education-and-support',
     251                'help-desk'                  => 'education-and-support',
     252                'online-support'             => 'education-and-support',
     253                'wiki'                       => 'education-and-support',
     254                'live-help'                  => 'education-and-support',
     255                'customer-service'           => 'education-and-support',
     256                'wikipedia'                  => 'education-and-support',
     257                'dictionary'                 => 'education-and-support',
     258                'language'                   => 'language-tools',
     259                'translation'                => 'language-tools',
     260                'multilingual'               => 'language-tools',
     261                'i18n'                       => 'language-tools',
     262                'localization'               => 'language-tools',
     263                'wpml'                       => 'language-tools',
     264                'multilanguage'              => 'language-tools',
     265                'l10n'                       => 'language-tools',
     266                'languages'                  => 'language-tools',
     267                'international'              => 'language-tools',
     268                'bilingual'                  => 'language-tools',
     269                'maps'                       => 'maps-and-location',
     270                'map'                        => 'maps-and-location',
     271                'google-maps'                => 'maps-and-location',
     272                'location'                   => 'maps-and-location',
     273                'geo'                        => 'maps-and-location',
     274                'google-map'                 => 'maps-and-location',
     275                'geolocation'                => 'maps-and-location',
     276                'address'                    => 'maps-and-location',
     277                'latitude'                   => 'maps-and-location',
     278                'mapping'                    => 'maps-and-location',
     279                'longitude'                  => 'maps-and-location',
     280                'gps'                        => 'maps-and-location',
     281                'geocoding'                  => 'maps-and-location',
     282                'foursquare'                 => 'maps-and-location',
     283                'images'                     => 'media',
     284                'image'                      => 'media',
     285                'gallery'                    => 'media',
     286                'media'                      => 'media',
     287                'video'                      => 'media',
     288                'photo'                      => 'media',
     289                'photos'                     => 'media',
     290                'slideshow'                  => 'media',
     291                'picture'                    => 'media',
     292                'pictures'                   => 'media',
     293                'thumbnail'                  => 'media',
     294                'upload'                     => 'media',
     295                'music'                      => 'media',
     296                'audio'                      => 'media',
     297                'thumbnails'                 => 'media',
     298                'icons'                      => 'media',
     299                'carousel'                   => 'media',
     300                'player'                     => 'media',
     301                'icon'                       => 'media',
     302                'mp3'                        => 'media',
     303                'videos'                     => 'media',
     304                'image-slider'               => 'media',
     305                'pdf'                        => 'media',
     306                'animation'                  => 'media',
     307                'attachment'                 => 'media',
     308                'featured-image'             => 'media',
     309                'attachments'                => 'media',
     310                'image-gallery'              => 'media',
     311                'album'                      => 'media',
     312                'playlist'                   => 'media',
     313                'responsive-slider'          => 'media',
     314                'photo-gallery'              => 'media',
     315                'photography'                => 'media',
     316                'galleries'                  => 'media',
     317                'media-library'              => 'media',
     318                'picasa'                     => 'media',
     319                'photo-albums'               => 'media',
     320                'nextgen'                    => 'media',
     321                'favicon'                    => 'media',
     322                'wordpress-slider'           => 'media',
     323                'nextgen-gallery'            => 'media',
     324                'slides'                     => 'media',
     325                'video-gallery'              => 'media',
     326                'animated'                   => 'media',
     327                'rotate'                     => 'media',
     328                'radio'                      => 'media',
     329                'video-player'               => 'media',
     330                'responsive-slideshow'       => 'media',
     331                'slide-show'                 => 'media',
     332                'mp4'                        => 'media',
     333                'streaming'                  => 'media',
     334                'image-slideshow'            => 'media',
     335                'photo-slider'               => 'media',
     336                'movie'                      => 'media',
     337                'swf'                        => 'media',
     338                'showcase'                   => 'media',
     339                'wordpress-gallery'          => 'media',
     340                'thickbox'                   => 'media',
     341                'responsive-gallery'         => 'media',
     342                'jpg'                        => 'media',
     343                'albums'                     => 'media',
     344                'screenshot'                 => 'media',
     345                'embedding'                  => 'media',
     346                'facebook-plugin'            => 'media',
     347                'photo-album'                => 'media',
     348                'post-thumbnail'             => 'media',
     349                'multisite'                  => 'multisite',
     350                'wpmu'                       => 'multisite',
     351                'network'                    => 'multisite',
     352                'mu'                         => 'multisite',
     353                'multi-site'                 => 'multisite',
     354                'wordpress-mu'               => 'multisite',
     355                'cache'                      => 'performance',
     356                'speed'                      => 'performance',
     357                'optimize'                   => 'performance',
     358                'optimization'               => 'performance',
     359                'maintenance'                => 'performance',
     360                'caching'                    => 'performance',
     361                'monitor'                    => 'performance',
     362                'fast'                       => 'performance',
     363                'rating'                     => 'ratings-and-reviews',
     364                'reviews'                    => 'ratings-and-reviews',
     365                'vote'                       => 'ratings-and-reviews',
     366                'testimonials'               => 'ratings-and-reviews',
     367                'review'                     => 'ratings-and-reviews',
     368                'poll'                       => 'ratings-and-reviews',
     369                'voting'                     => 'ratings-and-reviews',
     370                'quiz'                       => 'ratings-and-reviews',
     371                'testimonial'                => 'ratings-and-reviews',
     372                'ratings'                    => 'ratings-and-reviews',
     373                'polls'                      => 'ratings-and-reviews',
     374                'recommendations'            => 'ratings-and-reviews',
     375                'rate'                       => 'ratings-and-reviews',
     376                'ranking'                    => 'ratings-and-reviews',
     377                'security'                   => 'security-and-spam-protection',
     378                'spam'                       => 'security-and-spam-protection',
     379                'performance'                => 'security-and-spam-protection',
     380                'password'                   => 'security-and-spam-protection',
     381                'anti-spam'                  => 'security-and-spam-protection',
     382                'privacy'                    => 'security-and-spam-protection',
     383                'protection'                 => 'security-and-spam-protection',
     384                'antispam'                   => 'security-and-spam-protection',
     385                'secure'                     => 'security-and-spam-protection',
     386                'protect'                    => 'security-and-spam-protection',
     387                'ssl'                        => 'security-and-spam-protection',
     388                'permissions'                => 'security-and-spam-protection',
     389                'akismet'                    => 'security-and-spam-protection',
     390                'https'                      => 'security-and-spam-protection',
     391                'blacklist'                  => 'security-and-spam-protection',
     392                'wordpress-security'         => 'security-and-spam-protection',
     393                'firewall'                   => 'security-and-spam-protection',
     394                'ban'                        => 'security-and-spam-protection',
     395                'monitoring'                 => 'security-and-spam-protection',
     396                'malware'                    => 'security-and-spam-protection',
     397                'seo'                        => 'seo-and-marketing',
     398                'marketing'                  => 'seo-and-marketing',
     399                'search-engine-optimization' => 'seo-and-marketing',
     400                'sitemap'                    => 'seo-and-marketing',
     401                'traffic'                    => 'seo-and-marketing',
     402                'bing'                       => 'seo-and-marketing',
     403                'conversion'                 => 'seo-and-marketing',
     404                'search-engine'              => 'seo-and-marketing',
     405                'wordpress-seo'              => 'seo-and-marketing',
     406                'pagerank'                   => 'seo-and-marketing',
     407                'robots'                     => 'seo-and-marketing',
     408                'yandex'                     => 'seo-and-marketing',
     409                'schemaorg'                  => 'seo-and-marketing',
     410                'sitemaps'                   => 'seo-and-marketing',
     411                'lead-generation'            => 'seo-and-marketing',
     412                'rank'                       => 'seo-and-marketing',
     413                'opengraph'                  => 'seo-and-marketing',
     414                'marketing-automation'       => 'seo-and-marketing',
     415                'xml-sitemap'                => 'seo-and-marketing',
     416                'schema'                     => 'seo-and-marketing',
     417                'twitter'                    => 'social-sharing',
     418                'facebook'                   => 'social-sharing',
     419                'social'                     => 'social-sharing',
     420                'youtube'                    => 'social-sharing',
     421                'share'                      => 'social-sharing',
     422                'embed'                      => 'social-sharing',
     423                'social-media'               => 'social-sharing',
     424                'sharing'                    => 'social-sharing',
     425                'linkedin'                   => 'social-sharing',
     426                'tweet'                      => 'social-sharing',
     427                'flickr'                     => 'social-sharing',
     428                'pinterest'                  => 'social-sharing',
     429                'google-plus'                => 'social-sharing',
     430                'yahoo'                      => 'social-sharing',
     431                'instagram'                  => 'social-sharing',
     432                'vimeo'                      => 'social-sharing',
     433                'digg'                       => 'social-sharing',
     434                'bookmark'                   => 'social-sharing',
     435                'bookmarks'                  => 'social-sharing',
     436                'reddit'                     => 'social-sharing',
     437                'facebook-like'              => 'social-sharing',
     438                'social-network'             => 'social-sharing',
     439                'stumbleupon'                => 'social-sharing',
     440                'social-share'               => 'social-sharing',
     441                'tweets'                     => 'social-sharing',
     442                'tumblr'                     => 'social-sharing',
     443                'social-bookmarking'         => 'social-sharing',
     444                'oembed'                     => 'social-sharing',
     445                'facebook-share'             => 'social-sharing',
     446                'social-sharing'             => 'social-sharing',
     447                'myspace'                    => 'social-sharing',
     448                'follow'                     => 'social-sharing',
     449                'open-graph'                 => 'social-sharing',
     450                'social-networks'            => 'social-sharing',
     451                'social-networking'          => 'social-sharing',
     452                'qr-code'                    => 'social-sharing',
     453                'podcast'                    => 'social-sharing',
     454                'share-buttons'              => 'social-sharing',
     455                'twitter-widget'             => 'social-sharing',
     456                'like-button'                => 'social-sharing',
     457                'dailymotion'                => 'social-sharing',
     458                'social-icons'               => 'social-sharing',
     459                'twitter-share'              => 'social-sharing',
     460                'google-buzz'                => 'social-sharing',
     461                'stream'                     => 'social-sharing',
     462                'itunes'                     => 'social-sharing',
     463                'social-bookmarks'           => 'social-sharing',
     464                'addthis'                    => 'social-sharing',
     465                'social-buttons'             => 'social-sharing',
     466                'blogger'                    => 'social-sharing',
     467                'facebook-like-box'          => 'social-sharing',
     468                'facebook-like-button'       => 'social-sharing',
     469                'lastfm'                     => 'social-sharing',
     470                'share-button'               => 'social-sharing',
     471                'facebook-widget'            => 'social-sharing',
     472                'social-plugin'              => 'social-sharing',
     473                'fb'                         => 'social-sharing',
     474                'social-login'               => 'social-sharing',
     475                'friendfeed'                 => 'social-sharing',
     476                'social-plugins'             => 'social-sharing',
     477                'sharethis'                  => 'social-sharing',
     478                'twitter-feed'               => 'social-sharing',
     479                'retweet'                    => 'social-sharing',
     480                'soundcloud'                 => 'social-sharing',
     481                'like-box'                   => 'social-sharing',
     482                'social-widget'              => 'social-sharing',
     483                'likes'                      => 'social-sharing',
     484                'tweet-button'               => 'social-sharing',
     485                'vkontakte'                  => 'social-sharing',
     486                'slider-plugin'              => 'social-sharing',
     487                'google-plus-one'            => 'social-sharing',
     488                'googleplus'                 => 'social-sharing',
     489                'facebook-button'            => 'social-sharing',
     490                'twitter-button'             => 'social-sharing',
     491                'facebook-page'              => 'social-sharing',
     492                'msn'                        => 'social-sharing',
     493                'tags'                       => 'taxonomy',
     494                'categories'                 => 'taxonomy',
     495                'tag'                        => 'taxonomy',
     496                'taxonomy'                   => 'taxonomy',
     497                'keywords'                   => 'taxonomy',
     498                'taxonomies'                 => 'taxonomy',
     499                'terms'                      => 'taxonomy',
     500                'tagging'                    => 'taxonomy',
     501                'keyword'                    => 'taxonomy',
     502                'term'                       => 'taxonomy',
     503                'custom-taxonomy'            => 'taxonomy',
     504                'custom-taxonomies'          => 'taxonomy',
     505                'tag-cloud'                  => 'taxonomy',
     506                'meta-keywords'              => 'taxonomy',
     507                'meta-tags'                  => 'taxonomy',
     508                'registration'               => 'user-management',
     509                'members'                    => 'user-management',
     510                'membership'                 => 'user-management',
     511                'crm'                        => 'user-management',
     512                'signup'                     => 'user-management',
     513                'private'                    => 'user-management',
     514                'member'                     => 'user-management',
     515                'contacts'                   => 'user-management',
     516                'friends'                    => 'user-management',
     517                'tickets'                    => 'user-management',
     518                'roles'                      => 'user-management',
     519                'customer'                   => 'user-management',
     520                'ticket'                     => 'user-management',
     521                'team'                       => 'user-management',
     522                'user-profile'               => 'user-management',
     523                'jquery'                     => 'utilities-and-tools',
     524                'ajax'                       => 'utilities-and-tools',
     525                'javascript'                 => 'utilities-and-tools',
     526                'css'                        => 'utilities-and-tools',
     527                'database'                   => 'utilities-and-tools',
     528                'import'                     => 'utilities-and-tools',
     529                'backup'                     => 'utilities-and-tools',
     530                'export'                     => 'utilities-and-tools',
     531                'debug'                      => 'utilities-and-tools',
     532                'related-posts'              => 'utilities-and-tools',
     533                'weather'                    => 'utilities-and-tools',
     534                'tool'                       => 'utilities-and-tools',
     535                'calculator'                 => 'utilities-and-tools',
     536                'tools'                      => 'utilities-and-tools',
     537                'permalinks'                 => 'utilities-and-tools',
     538                'acf'                        => 'utilities-and-tools',
     539                'importer'                   => 'utilities-and-tools',
     540                'cdn'                        => 'utilities-and-tools',
     541                'mysql'                      => 'utilities-and-tools',
     542                'feedburner'                 => 'utilities-and-tools',
     543                'cron'                       => 'utilities-and-tools',
     544                'offline'                    => 'utilities-and-tools',
     545                'advanced-custom-fields'     => 'utilities-and-tools',
     546                'bitly'                      => 'utilities-and-tools',
     547                's3'                         => 'utilities-and-tools',
     548                'mootools'                   => 'utilities-and-tools',
     549                'maintenance-mode'           => 'utilities-and-tools',
     550                'shortlink'                  => 'utilities-and-tools',
     551                'converter'                  => 'utilities-and-tools',
     552                'migration'                  => 'utilities-and-tools',
     553                'dropbox'                    => 'utilities-and-tools',
     554                'tinyurl'                    => 'utilities-and-tools',
     555                'url-shortener'              => 'utilities-and-tools',
     556                'sql'                        => 'utilities-and-tools',
     557                'debugging'                  => 'utilities-and-tools',
     558                'short-url'                  => 'utilities-and-tools',
     559        );
     560
     561        /**
     562         * Maps tags to plugin categories.
     563         *
     564         * @param array $tags Plugin tags from readme.txt.
     565         * @return array
     566         */
     567        public static function map( $tags ) {
     568                $categories = array();
     569
     570                foreach ( $tags as $tag ) {
     571                        if ( isset( self::$map[ $tag ] ) ) {
     572                                $categories[] = get_term_by( 'slug', self::$map[ $tag ], 'plugin_category' )->term_id;
     573                        }
     574                }
     575
     576                return array_slice( array_unique( $categories ), 0, 3 );
     577        }
     578}