Making WordPress.org


Ignore:
Timestamp:
03/07/2019 11:29:31 PM (7 years ago)
Author:
coffee2code
Message:

Jobs: Extend (and rename) WordPress_dangit() to also fix display of malformed attempts at "BuddyPress" and "bbPress".

H/t dimensionmedia.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/jobs.wordpress.net/public_html/wp-content/plugins/jobswp/jobswp.php

    r8408 r8409  
    119119        add_filter( 'posts_request',                  array( $this, 'admin_search_job_posts_request' ), 10, 2 );
    120120
    121         foreach ( array( 'the_content', 'the_title', 'single_post_title' ) as $filter )
    122             add_filter( $filter,                      array( $this, 'WordPress_dangit' ) );
     121        foreach ( [ 'the_content', 'the_title', 'single_post_title' ] as $filter ) {
     122            add_filter( $filter,                  array( $this, 'proper_project_names_dangit' ) );
     123        }
    123124
    124125        add_action( 'save_post_job',                  array( $this, 'email_job_poster' ), 10, 3 );
     
    497498
    498499    /**
    499      * Replaces all malformed attempts at "WordPress" with "WordPress".
     500     * Replaces all malformed attempts at "WordPress", "BuddyPress", and "bbPress"
     501     * project names with proper spelling of the names.
    500502     *
    501503     * This is a bit broad-stroked for general use, but should be sufficient for job postings.
    502504     *
    503      * @param string $text Text to process for malformed "WordPress" usage
     505     * @param string $text Text to process for malformed project names.
    504506     * @return string The fixed text
    505507     */
    506     public function WordPress_dangit( $text ) {
    507         return str_replace(
    508             array( 'Wordpress', 'wordpress', 'wordPress', 'word press', 'Word press', 'word Press', 'Word Press' ),
     508    public function proper_project_names_dangit( $text ) {
     509        $text = str_replace(
     510            [ 'Wordpress', 'wordpress', 'wordPress', 'word press', 'Word press', 'word Press', 'Word Press' ],
    509511            'WordPress',
    510512            $text
    511513        );
     514
     515        $text = str_replace(
     516            [ 'Buddypress', 'buddypress', 'buddyPress', 'buddy press', 'Buddy press', 'buddy Press', 'Buddy Press' ],
     517            'BuddyPress',
     518            $text
     519        );
     520
     521        $text = str_replace(
     522            [ 'Bbpress', 'BBpress', 'BBPress', 'BbPress', 'bbpress', 'bb press', 'Bb press', 'bb Press', 'BB press', 'BB Press' ],
     523            'bbPress',
     524            $text
     525        );
     526
    512527        return $text;
    513528    }
Note: See TracChangeset for help on using the changeset viewer.