Making WordPress.org


Ignore:
Timestamp:
02/18/2018 02:52:17 PM (6 years ago)
Author:
ocean90
Message:

Rosetta Roles: Move get_parent_project() to the main class.

See #1613.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/class-translation-editors-list-table.php

    r6683 r6684  
    339339        foreach ( $project_access_list as $project_id ) {
    340340            if ( $this->projects[ $project_id ] ) {
    341                 $parent = $this->get_parent_project( $this->project_tree, $project_id );
     341                $parent = $this->rosetta_roles->get_parent_project( $this->project_tree, $project_id );
    342342                if ( $parent->id != $project_id ) {
    343343                    $name = sprintf(
     
    363363        echo implode( '<br>', $projects );
    364364    }
    365 
    366     /**
    367      * Returns the parent project for a sub project.
    368      *
    369      * @param array $tree The project tree.
    370      * @param int $child_id The project tree.
    371      * @return object The parent project.
    372      */
    373     private function get_parent_project( $tree, $child_id ) {
    374         $parent = null;
    375         foreach ( $tree as $project ) {
    376             if ( $project->id == $child_id ) {
    377                 $parent = $project;
    378                 break;
    379             }
    380 
    381             if ( isset( $project->sub_projects ) ) {
    382                 $parent = $this->get_parent_project( $project->sub_projects, $child_id );
    383                 if ( $parent ) {
    384                     $parent = $project;
    385                     break;
    386                 }
    387             }
    388         }
    389 
    390         return $parent;
    391     }
    392365}
Note: See TracChangeset for help on using the changeset viewer.