/** * Apply translations of slugs to all $wp->query_vars */ function qtranxf_slug_parse_request(&$wp) { //calss WP //qtranxf_dbg_log('qtranxf_slug_parse_request: $wp: ',$wp); //qtranxf_dbg_log('qtranxf_slug_parse_request: query_vars: ',$wp->query_vars); //qtranxf_dbg_log('qtranxf_slug_parse_request: query_string: ',$wp->query_string); //qtranxf_dbg_log('qtranxf_slug_parse_request: request: ',$wp->request); //qtranxf_dbg_log('qtranxf_slug_parse_request: matched_rule: ',$wp->matched_rule); //qtranxf_dbg_log('qtranxf_slug_parse_request: matched_query: ',$wp->matched_query); //qtranxf_dbg_log('qtranxf_slug_parse_request: did_permalink: ',$wp->did_permalink); foreach ($wp->query_vars as $k => $v) { $info = qtranxf_slug_translation($v); if (!isset($info['name'])) { continue; } $wp->query_vars[$k] = $info['name']; } //qtranxf_dbg_log('qtranxf_slug_parse_request: done: query_vars: ',$wp->query_vars); //global $wp_rewrite; //qtranxf_dbg_log('qtranxf_slug_parse_request: wp_rewrite: ',$wp_rewrite); }
/** * @param (string) $slug - rawurlencoded slug. * @return string - rawurlencoded default language slug. */ function qtranxf_slug_get_name($slug) { $info = qtranxf_slug_translation($slug); if (isset($info['name'])) { return $info['name']; } //qtranxf_dbg_log('qtranxf_slug_get_name: '.$slug.' => ', $info); return null; }