Ticket #1124: 1124.diff
File 1124.diff, 2.2 KB (added by , 10 years ago) |
---|
-
sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/wporg-routes.php
27 27 $path = '(.+?)'; 28 28 $locale = '(' . implode( '|', array_map( function( $locale ) { return $locale->slug; }, GP_Locales::locales() ) ) . ')'; 29 29 30 // Unset default routes.31 unset( GP::$router->urls['/'] );32 unset( GP::$router->urls["get:/languages/$locale/$path"] );33 unset( GP::$router->urls["get:/languages/$locale"] );34 unset( GP::$router->urls['get:/languages'] );35 36 30 // Redirect routes. 37 GP::$router-> add( "/languages/$path", array( 'GP_WPorg_Route_Redirector', 'redirect_languages' ) );38 GP::$router-> add( '/languages', array( 'GP_WPorg_Route_Redirector', 'redirect_languages' ) );31 GP::$router->prepend( "/languages/$path", array( 'GP_WPorg_Route_Redirector', 'redirect_languages' ) ); 32 GP::$router->prepend( '/languages', array( 'GP_WPorg_Route_Redirector', 'redirect_languages' ) ); 39 33 40 34 // Register custom routes. 41 GP::$router-> add( '/', array( 'GP_WPorg_Route_Index', 'get_locales' ) );42 GP::$router-> add( "/locale/$locale/$path/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_project' ) );43 GP::$router-> add( "/locale/$locale/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );44 GP::$router-> add( "/locale/$locale/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );45 GP::$router-> add( "/locale/$locale", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) );35 GP::$router->prepend( '/', array( 'GP_WPorg_Route_Index', 'get_locales' ) ); 36 GP::$router->prepend( "/locale/$locale/$path/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_project' ) ); 37 GP::$router->prepend( "/locale/$locale/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) ); 38 GP::$router->prepend( "/locale/$locale/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) ); 39 GP::$router->prepend( "/locale/$locale", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) ); 46 40 } 47 41 } 48 42