function bb_repermalink() { global $page; $location = bb_get_location(); $uri = $_SERVER['REQUEST_URI']; if (isset($_GET['id'])) { $id = $_GET['id']; } else { $id = bb_get_path(); } $_original_id = $id; do_action('pre_permalink', $id); $id = apply_filters('bb_repermalink', $id); switch ($location) { case 'front-page': $path = null; $querystring = null; if ($page > 1) { if (bb_get_option('mod_rewrite')) { $path = 'page/' . $page; } else { $querystring = array('page' => $page); } } $permalink = bb_get_uri($path, $querystring, BB_URI_CONTEXT_HEADER); $issue_404 = true; break; case 'forum-page': if (empty($id)) { $permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER); break; } global $forum_id, $forum; $forum = bb_get_forum($id); $forum_id = $forum->forum_id; $permalink = get_forum_link($forum->forum_id, $page); break; case 'topic-edit-page': case 'topic-page': if (empty($id)) { $permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER); break; } global $topic_id, $topic; $topic = get_topic($id); $topic_id = $topic->topic_id; $permalink = get_topic_link($topic->topic_id, $page); break; case 'profile-page': // This handles the admin side of the profile as well. global $user_id, $user, $profile_hooks, $self; if (isset($_GET['id'])) { $id = $_GET['id']; } elseif (isset($_GET['username'])) { $id = $_GET['username']; } else { $id = bb_get_path(); } $_original_id = $id; if (!$id) { $user = bb_get_current_user(); // Attempt to go to the current users profile } else { if (bb_get_option('mod_rewrite') === 'slugs') { if (!($user = bb_get_user_by_nicename($id))) { $user = bb_get_user($id); } } else { if (!($user = bb_get_user($id))) { $user = bb_get_user_by_nicename($id); } } } if (!$user || 1 == $user->user_status && !bb_current_user_can('moderate')) { bb_die(__('User not found.'), '', 404); } $user_id = $user->ID; bb_global_profile_menu_structure(); $valid = false; if ($tab = isset($_GET['tab']) ? $_GET['tab'] : bb_get_path(2)) { foreach ($profile_hooks as $valid_tab => $valid_file) { if ($tab == $valid_tab) { $valid = true; $self = $valid_file; } } } if ($valid) { $permalink = get_profile_tab_link($user->ID, $tab, $page); } else { $permalink = get_user_profile_link($user->ID, $page); unset($self, $tab); } break; case 'favorites-page': $permalink = get_favorites_link(); break; case 'tag-page': // It's not an integer and tags.php pulls double duty. $id = isset($_GET['tag']) ? $_GET['tag'] : false; if (!$id || !bb_get_tag((string) $id)) { $permalink = bb_get_tag_page_link(); } else { global $tag, $tag_name; $tag_name = $id; $tag = bb_get_tag((string) $id); $permalink = bb_get_tag_link(0, $page); // 0 => grabs $tag from global. } break; case 'view-page': // Not an integer if (isset($_GET['view'])) { $id = $_GET['view']; } else { $id = bb_get_path(); } $_original_id = $id; global $view; $view = $id; $permalink = get_view_link($view, $page); break; default: return; break; } nxt_parse_str($_SERVER['QUERY_STRING'], $args); $args = urlencode_deep($args); if ($args) { $permalink = add_query_arg($args, $permalink); if (bb_get_option('mod_rewrite')) { $pretty_args = array('id', 'page', 'tag', 'tab', 'username'); // these are already specified in the path if ($location == 'view-page') { $pretty_args[] = 'view'; } foreach ($pretty_args as $pretty_arg) { $permalink = remove_query_arg($pretty_arg, $permalink); } } } $permalink = apply_filters('bb_repermalink_result', $permalink, $location); $domain = bb_get_option('domain'); $domain = preg_replace('/^https?/', '', $domain); $check = preg_replace('|^.*' . trim($domain, ' /') . '|', '', $permalink, 1); $uri = rtrim($uri, " \t\n\r\v?"); $uri = str_replace('/index.php', '/', $uri); global $bb_log; $bb_log->debug($uri, 'bb_repermalink() ' . __('REQUEST_URI')); $bb_log->debug($check, 'bb_repermalink() ' . __('should be')); $bb_log->debug($permalink, 'bb_repermalink() ' . __('full permalink')); $bb_log->debug(isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : null, 'bb_repermalink() ' . __('PATH_INFO')); if ($check != $uri && $check != str_replace(urlencode($_original_id), $_original_id, $uri)) { if ($issue_404 && rtrim($check, " \t\n\r\v/") !== rtrim($uri, " \t\n\r\v/")) { status_header(404); bb_load_template('404.php'); } else { nxt_redirect($permalink); } exit; } do_action('post_permalink', $permalink); }
/** * Administration Screen CSS for changing the styles. * * If installing the 'nxt-admin/' directory will be replaced with './'. * * The $_nxt_admin_css_colors global manages the Administration Screens CSS * stylesheet that is loaded. The option that is set is 'admin_color' and is the * color and key for the array. The value for the color key is an object with * a 'url' parameter that has the URL path to the CSS file. * * The query from $src parameter will be appended to the URL that is given from * the $_nxt_admin_css_colors array value URL. * * @since 2.6.0 * @uses $_nxt_admin_css_colors * * @param string $src Source URL. * @param string $handle Either 'colors' or 'colors-rtl'. * @return string URL path to CSS stylesheet for Administration Screens. */ function nxt_style_loader_src($src, $handle) { if (defined('nxt_INSTALLING')) { return preg_replace('#^nxt-admin/#', './', $src); } if ('colors' == $handle || 'colors-rtl' == $handle) { global $_nxt_admin_css_colors; $color = get_user_option('admin_color'); if (empty($color) || !isset($_nxt_admin_css_colors[$color])) { $color = 'fresh'; } $color = $_nxt_admin_css_colors[$color]; $parsed = parse_url($src); $url = $color->url; if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { $url = preg_replace('/.css$|.css(?=\\?)/', '.dev.css', $url); } if (isset($parsed['query']) && $parsed['query']) { nxt_parse_str($parsed['query'], $qv); $url = add_query_arg($qv, $url); } return $url; } return $src; }
/** * Merge user defined arguments into defaults array. * * This function is used throughout NXTClass to allow for both string or array * to be merged into another array. * * @since 2.2.0 * * @param string|array $args Value to merge with $defaults * @param array $defaults Array that serves as the defaults. * @return array Merged user defined values with defaults. */ function nxt_parse_args($args, $defaults = '') { if (is_object($args)) { $r = get_object_vars($args); } elseif (is_array($args)) { $r =& $args; } else { nxt_parse_str($args, $r); } if (is_array($defaults)) { return array_merge($defaults, $r); } return $r; }
function parse_query() { if ($args = func_get_args()) { call_user_func_array(array(&$this, 'init'), $args); } if (is_array($this->query)) { $this->query_vars = $this->query; } else { nxt_parse_str($this->query, $this->query_vars); } do_action_ref_array('bb_parse_query', array(&$this)); if (false === $this->query_vars) { return; } $this->query_vars = $this->fill_query_vars($this->query_vars); }
* @subpackage Administration */ if (is_network_admin()) { do_action('_network_admin_menu'); } elseif (is_user_admin()) { do_action('_user_admin_menu'); } else { do_action('_admin_menu'); } // Create list of page plugin hook names. foreach ($menu as $menu_page) { if (false !== ($pos = strpos($menu_page[2], '?'))) { // Handle post_type=post|page|foo pages. $hook_name = substr($menu_page[2], 0, $pos); $hook_args = substr($menu_page[2], $pos + 1); nxt_parse_str($hook_args, $hook_args); // Set the hook name to be the post type. if (isset($hook_args['post_type'])) { $hook_name = $hook_args['post_type']; } else { $hook_name = basename($hook_name, '.php'); } unset($hook_args); } else { $hook_name = basename($menu_page[2], '.php'); } $hook_name = sanitize_title($hook_name); if (isset($compat[$hook_name])) { $hook_name = $compat[$hook_name]; } elseif (!$hook_name) { continue;