Making WordPress.org

Changeset 1602


Ignore:
Timestamp:
05/20/2015 05:57:13 PM (10 years ago)
Author:
coffee2code
Message:

jobs.wordpress.net: Explicitly declare class methods as public or protected. Fix a static method invocation.

File:
1 edited

Legend:

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

    r497 r1602  
    7070     * Constructor
    7171     */
    72     function __construct() {
     72    protected function __construct() {
    7373        if ( class_exists( 'Walker_Jobs_Category' ) )
    7474            self::$walker = new Walker_Jobs_Category;
     
    8383     * Invokes registration of custom post type, taxonomy, and statuses.
    8484     */
    85     function registrations() {
     85    public function registrations() {
    8686        $this->register_post_type();
    8787        $this->register_post_status();
     
    9393     * as any processing that needs to happen directly on 'init'.
    9494     */
    95     function init() {
     95    public function init() {
    9696        // Allow customization of the number of days until a job gets pruned.
    9797        // By default, it is 21 days.
     
    129129     * @return array The amended list of allowed tags
    130130     */
    131     function wp_kses_allowed_html( $allowedtags, $content ) {
     131    public function wp_kses_allowed_html( $allowedtags, $content ) {
    132132        // Add permissable tags
    133133        $allowedtags['ol'] = array();
     
    151151     * @return array The amended list of classes to be added to 'body' tag
    152152     */
    153     function body_class( $classes ) {
     153    public function body_class( $classes ) {
    154154        $classes[] = 'jobswp';
    155155        return $classes;
     
    165165     * @return array Amended associated array of column names and labels
    166166     */
    167     function posts_columns( $columns, $post_type ) {
     167    public function posts_columns( $columns, $post_type ) {
    168168        if ( 'job' !== $post_type ) {
    169169            return $columns;
     
    180180     * @param int $post_id The post ID
    181181     */
    182     function custom_posts_columns( $column_name, $post_id ) {
     182    public function custom_posts_columns( $column_name, $post_id ) {
    183183        switch ( $column_name ) {
    184184            case 'poster':
     
    200200     * Registers the custom post type.
    201201     */
    202     function register_post_type() {
     202    protected function register_post_type() {
    203203        $labels = array(
    204204            'name'                => _x( 'Jobs', 'Post Type General Name', 'jobswp' ),
     
    242242     * Registers the custom post statuses.
    243243     */
    244     function register_post_status() {
     244    protected function register_post_status() {
    245245        // Status of 'closed' indicates a job that was unpublished from the site.
    246246        register_post_status( 'closed', array(
     
    268268     * Registers the custom taxonomy.
    269269     */
    270     function register_taxonomy()  {
     270    protected function register_taxonomy()  {
    271271        $labels = array(
    272272            'name'                       => _x( 'Job Categories', 'Taxonomy General Name', 'jobswp' ),
     
    301301     * user account does not exist.
    302302     */
    303     function alert_if_no_jobposter() {
     303    public function alert_if_no_jobposter() {
    304304        global $pagenow;
    305305
     
    319319     * Outputs button to close a job on the post edit page.
    320320     */
    321     function post_submitbox_start() {
     321    public function post_submitbox_start() {
    322322        global $post;
    323323
     
    365365     * @return boolean True == the job can be closed
    366366     */
    367     function can_job_be_closed( $post ) {
     367    protected function can_job_be_closed( $post ) {
    368368        // The post must exist
    369369        if ( ! $post )
     
    468468     * @return array
    469469     */
    470     function post_row_actions( $actions, $post ) {
     470    public function post_row_actions( $actions, $post ) {
    471471        if ( $this->can_job_be_closed( $post ) )
    472472            $actions['close'] = $this->_get_close_link( $post );
     
    483483     * @return string The fixed text
    484484     */
    485     function WordPress_dangit( $text ) {
     485    public function WordPress_dangit( $text ) {
    486486        return str_replace(
    487487            array( 'Wordpress', 'wordpress', 'wordPress', 'word press', 'Word press', 'word Press', 'Word Press' ),
     
    498498     * @return string The content appended with the post-a-job form
    499499     */
    500     function add_post_a_job_form( $content ) {
     500    public function add_post_a_job_form( $content ) {
    501501        if ( ! $this->skip_content && is_page( 'post-a-job' ) ) {
    502502            $this->skip_content = true;
     
    517517     * unverified visitor.
    518518     */
    519     function save_job() {
     519    public function save_job() {
    520520        if ( isset( $_POST['postjob'] ) && 1 == $_POST['postjob'] ) {
    521521            check_admin_referer( 'jobswppostjob' );
     
    551551            // If everything checks out, create the job
    552552            if ( $this->success ) {
    553 
    554553                $job_id = $this->create_job();
    555 
    556554                if ( is_wp_error( $job_id ) ) {
    557555                    $_POST['errors'] = $job_id->get_error_message();
     
    606604
    607605                // Massage and sanitize the field value depending on field
    608                 $val = $this->validate_job_field( $field, $_POST[ $field ], $_POST );
     606                $val = self::validate_job_field( $field, $_POST[ $field ], $_POST );
    609607
    610608                add_post_meta( $job_id, $field, $val );
     
    627625     * Prunes old jobs.
    628626     */
    629     function scheduled_job_pruning() {
     627    public function scheduled_job_pruning() {
    630628        global $wpdb;
    631629
     
    641639     * Unschedules job pruning cron.
    642640     */
    643     static function unschedule_job_pruning() {
     641    public static function unschedule_job_pruning() {
    644642        wp_clear_scheduled_hook( 'jobswp_scheduled_job_pruning' );
    645643    }
     
    658656     * @return string
    659657     */
    660     function validate_job_field( $field, $value, $extra_data = array() ) {
     658    public static function validate_job_field( $field, $value, $extra_data = array() ) {
    661659        switch ( $field ) {
    662660            case 'email':
Note: See TracChangeset for help on using the changeset viewer.