uawdijnntqw1x1x1
IP : 18.224.215.88
Hostname : c17w.hoster.ru
Kernel : Linux c17w.hoster.ru 3.10.0 #1 SMP Tue Jan 25 12:49:12 MSK 2022 x86_64
Disable Function : dl,shell_exec,exec,system,passthru,popen,proc_open,proc_nice,proc_get_status,proc_close,proc_terminate,posix_mkfifo,chown,chgrp,show_source,opcache_reset,opcache_get_configuration,opcache_get_status
OS : Linux
PATH:
/
home
/
srv221441
/
kso-don.ru
/
wp-content
/
plugins
/
presto-player
/
inc
/
..
/
dist
/
.
/
.
/
..
/
src
/
router
/
index.js
/
/
import { Component } from "@wordpress/element"; import { locationToRoute } from "./utils"; import { history, RouterContext } from "./context"; import { Route } from "./route"; import { Link } from "./link"; import { match } from "path-to-regexp"; class Router extends Component { constructor(props) { super(props); // Convert our routes into an array for easy 404 checking this.routes = Object.keys(props.routes).map( (key) => props.routes[key].path ); // Listen for path changes from the history API this.unlisten = history.listen(this.handleRouteChange); const route = locationToRoute(history.location); const { search } = history.location; // Define the initial RouterContext value this.state = { route, defaultRoute: props?.defaultRoute ? `${search}#${props?.defaultRoute}` : `${search}#/`, }; } componentWillUnmount() { // Stop listening for changes if the Router component unmounts this.unlisten(); } handleRouteChange = (location) => { const route = locationToRoute(location?.location); this.setState({ route: route }); }; render() { // Define our variables const { children, NotFound } = this.props; const { route, defaultRoute } = this.state; if (!route.hash) { history.push(defaultRoute); return <div></div>; } let matched = false; // match route (this.routes || []).forEach((name) => { const checkMatch = match(route.hash.substr(1)); const isMatched = checkMatch(`${route.hash.substr(1)}`); if (!isMatched) { return; } matched = { name, data: isMatched, }; }); const routerContextValue = { route, matched }; // Check if 404 if no route matched const is404 = !matched; return ( <RouterContext.Provider value={routerContextValue}> {is404 ? <div>Not found</div> : children} </RouterContext.Provider> ); } } export { history, RouterContext, Router, Route, Link };
/home/srv221441/kso-don.ru/wp-content/plugins/presto-player/inc/../dist/././../src/router/index.js