Changeset 1750
- Timestamp:
- 07/18/2015 02:32:27 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/wporg-routes.php
r1721 r1750 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'] ); 30 // Delete default routes. 31 GP::$router->remove("/languages/$locale"); 32 GP::$router->remove("/languages/$locale/$path"); 35 33 36 34 // 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' ) );35 GP::$router->prepend( '/languages', array( 'GP_WPorg_Route_Redirector', 'redirect_languages' ) ); 36 GP::$router->prepend( "/languages/$path", array( 'GP_WPorg_Route_Redirector', 'redirect_languages' ) ); 39 37 40 38 // 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' ) );39 GP::$router->prepend( '/', array( 'GP_WPorg_Route_Index', 'get_locales' ) ); 40 GP::$router->prepend( "/locale/$locale", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) ); 41 GP::$router->prepend( "/locale/$locale/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) ); 42 GP::$router->prepend( "/locale/$locale/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_projects' ) ); 43 GP::$router->prepend( "/locale/$locale/$path/$path/$path", array( 'GP_WPorg_Route_Locale', 'get_locale_project' ) ); 46 44 } 47 45 }
Note: See TracChangeset
for help on using the changeset viewer.