Changeset 1607837
- Timestamp:
- 03/04/2017 03:05:11 PM (9 years ago)
- Location:
- wtools/trunk
- Files:
-
- 2 edited
-
includes/router.php (modified) (3 diffs)
-
wtools.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wtools/trunk/includes/router.php
r1606332 r1607837 1 1 <?php 2 3 if (!defined('WTOOLS_ROUTE')) {4 define('WTOOLS_ROUTE', 'wroute');5 }6 2 7 3 /** … … 27 23 28 24 private function __construct() { 29 add_filter('query_vars', array($this, 'wp_query_vars'));30 25 add_action('parse_request', array($this, 'wp_parse_request')); 31 26 } 32 27 33 public function wp_query_vars($vars) {34 $vars[] = WTOOLS_ROUTE;35 return $vars;36 }37 38 28 public function wp_parse_request(&$wp) { 39 if (empty($wp->query_vars[WTOOLS_ROUTE])) { 29 if (empty($wp->request)) { 30 // Early exit. We do not handle home page noway. 40 31 return; 41 32 } 42 $current_route = $wp->query_vars[WTOOLS_ROUTE];43 33 foreach ($this->routes as $path => $route_info) { 44 if (preg_match("@^$path@", $ current_route)) {34 if (preg_match("@^$path@", $wp->request)) { 45 35 if (isset($route_info['file'])) { 46 36 require_once($route_info['file']); … … 79 69 function wtools_get_url($route, $query = array()) { 80 70 if (count($query)) { 81 $query_string = '&' .http_build_query($query);71 $query_string = http_build_query($query); 82 72 } 83 73 else { 84 74 $query_string = ''; 85 75 } 86 return site_url("index.php ?" . WTOOLS_ROUTE . "={$route}{$query_string}");76 return site_url("index.php/{$route}?{$query_string}"); 87 77 } -
wtools/trunk/wtools.php
r1607090 r1607837 8 8 Plugin URI: https://wordpress.org/plugins/wtools/ 9 9 Description: WTools brings various functions and classes to make developing other plugins faster. 10 Version: 0. 710 Version: 0.8 11 11 Author: Junaid 12 12 License: GPLv2 or later
Note: See TracChangeset
for help on using the changeset viewer.