Changeset 4011 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-plugin-directory/inc/sync/class-translation-sync.php
- Timestamp:
- 09/08/2016 09:55:13 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-plugin-directory/inc/sync/class-translation-sync.php
r3603 r4011 6 6 use GP_Locales; 7 7 use GP_Translation; 8 use WordPressdotorg\GlotPress\Plugin_Directory\Plugin; 8 9 9 10 class Translation_Sync { 10 public $master_project = 'wp-plugins';11 11 12 12 private $queue = array(); … … 44 44 45 45 $project = GP::$project->get( $project_id ); 46 if ( ! $project || ! $this->project_is_plugin( $project->path ) ) {46 if ( ! $project || ! Plugin::project_is_plugin( $project->path ) ) { 47 47 return; 48 48 } … … 75 75 */ 76 76 public function sync_plugin_translations_on_commit( $args ) { 77 $project = GP::$project->by_path( $this->master_project. '/' . $args['gp_project'] );77 $project = GP::$project->by_path( Plugin::GP_MASTER_PROJECT . '/' . $args['gp_project'] ); 78 78 if ( ! $project ) { 79 79 return false; … … 151 151 } 152 152 153 if ( ! $this->project_is_plugin( $project->path ) ) {153 if ( ! Plugin::project_is_plugin( $project->path ) ) { 154 154 return; 155 155 } … … 290 290 291 291 /** 292 * Returns whether a project path belongs to the plugins project.293 *294 * @param string $path Path of a project.295 *296 * @return bool True if it's a plugin, false if not.297 */298 public function project_is_plugin( $path ) {299 if ( empty( $path ) ) {300 return false;301 }302 303 $path = '/' . trim( $path, '/' ) . '/';304 if ( false === strpos( $path, "/{$this->master_project}/" ) ) {305 return false;306 }307 308 return true;309 }310 311 /**312 292 * Sends a notifcation to the the Slack channel. 313 293 *
Note: See TracChangeset
for help on using the changeset viewer.