当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::path方法代码示例

本文整理汇总了PHP中Request::path方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::path方法的具体用法?PHP Request::path怎么用?PHP Request::path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Request的用法示例。


在下文中一共展示了Request::path方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set_active

/**
 * Help in setting the class of the active link to 'active'
 * If another class is required,
 * pass a third parameter of class name
 * @param $path
 * @param string $secondPath
 * @param string $active
 * @return string
 */
function set_active($path, $secondPath = '', $active = 'active')
{
    if ($path == 'admin/search' && strpos(Request::path(), 'admin/search') !== false) {
        return $active;
    }
    return Request::is($path) || Request::is($secondPath) ? $active : '';
}
开发者ID:Korogba,项目名称:mathlibrary,代码行数:16,代码来源:helpers.php

示例2: set_expanded

/**
 * @param array $array
 * @param string $active
 * @return string
 */
function set_expanded($array = array(), $active = 'nav-expanded')
{
    $path = Request::path();
    if (in_array($path, $array)) {
        return Request::is($path) ? $active : '';
    }
}
开发者ID:norja25,项目名称:16._julijs,代码行数:12,代码来源:helpers.php

示例3: isActive

 /**
  * Determine whether this navigation item is active or not.
  * This implementation tries to guess it based on the request
  * URL and query parameters.
  *
  * @return boolean  true if item is active, false otherwise
  */
 public function isActive()
 {
     if (isset($this->active)) {
         return $this->active;
     }
     $url = $this->getURL();
     // if URL is set, try to guess whether active or not
     if (isset($url)) {
         list($request_path, $query) = explode('?', Request::path());
         list($request_url, $query) = explode('?', Request::url());
         list($url, $query) = explode('?', $url);
         if (!preg_match('%^[a-z]+:%', $url) && $url[0] !== '/') {
             $url = $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] . $url;
         }
         if ($url === $request_path || $url === $request_url) {
             $this->active = true;
             if (isset($this->params)) {
                 foreach ($this->params as $key => $val) {
                     if (Request::get($key) != $val) {
                         $this->active = false;
                     }
                 }
             }
             if ($this->active) {
                 return true;
             }
         }
     }
     return $this->active = (bool) $this->activeSubNavigation();
 }
开发者ID:ratbird,项目名称:hope,代码行数:37,代码来源:AutoNavigation.php

示例4: init

 /**
  * Creates a Laravel route, returning a closure which passes the raw input to AngularPHP and returns the response
  */
 protected function init()
 {
     $route = func_get_arg(0);
     $this->setErrorHandler(function (\Exception $e, Request $r) {
         \Log::error($e, $r->toArray());
     });
     $endpoint = $this;
     \Route::any($route, function () use($endpoint) {
         $path = '/' . \Request::path();
         $referrer = \Request::header('referer');
         $host = \Request::header('host');
         if (($origin = \Request::header('Origin')) && count($this->corsHosts)) {
             $this->setCorsOrigin($origin);
         }
         /**
          * If being called remotely, add the domain name to the URI
          */
         if (strlen($referrer) && parse_url($referrer, PHP_URL_HOST) != $host) {
             $uri = '//' . $host . $path;
         } else {
             $uri = $path;
         }
         $request = new Request(\Request::json()->all());
         $response = $endpoint->setUri($uri)->execute($request, \Request::getMethod());
         return \Response::make($response->content, $response->code, $response->headers)->header('Content-Type', $response->contentType);
     });
 }
开发者ID:echobot,项目名称:angularphp,代码行数:30,代码来源:Laravel.php

示例5: getPath

 /**
  * La methode getPath() est une methode qui permet de recuperer la variable
  * locale $path
  * @return array() retourne un tableau de l'arboressance de l'url
  */
 public static function getPath()
 {
     if (self::$path == null) {
         self::$path = isset($_GET['PATH']) ? explode('/', $_GET['PATH']) : array();
     }
     return self::$path;
 }
开发者ID:bolchevian,项目名称:font,代码行数:12,代码来源:Request.class.php

示例6: validate

 /**
  * @param Request $request
  * @return RouteResult
  */
 public function validate(Request $request)
 {
     $parameters = [];
     $matched = $this->method === $request->method();
     $matched = $matched && preg_match($this->path, $request->path(), $parameters);
     return new RouteResult($matched, $parameters, $this->response_factory);
 }
开发者ID:chemisus,项目名称:dragon,代码行数:11,代码来源:MethodPathRoute.php

示例7: execute

 public function execute()
 {
     $sPath = Request::path();
     foreach ($this->routes as $sKey => $sMethod) {
         if (preg_match('~' . $sKey . '~', $sPath)) {
             debug(get_class($this) . " -> {$sMethod}() [{$sPath} => {$sKey}]");
             if ($sMethod[0] == '#') {
                 $sMethod = substr($sMethod, 1);
                 if (class_exists($sMethod)) {
                     return Service::create($sMethod)->execute();
                 } else {
                     debug('Service not found: ' . $sMethod);
                     $this->error404();
                 }
             } else {
                 if (method_exists($this, $sMethod)) {
                     $this->catchAll();
                     $bReturn = $this->{$sMethod}();
                     P::mark(get_class($this) . '::' . $sMethod);
                     Response::end();
                     return $bReturn;
                 } else {
                     debug('Method not found: ' . get_class($this) . '::' . $sMethod . '()');
                     $this->error404();
                 }
             }
         }
     }
     debug(get_class($this) . " -> NO MATCH");
     return false;
 }
开发者ID:apodgorny,项目名称:minimum,代码行数:31,代码来源:class.Service.php

示例8: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $path = Request::path();
     $pathid = explode('/', $path);
     $id = $pathid[1];
     return ['username' => 'required|max:255', 'email' => 'required|email|max:255|unique:users' . ($id ? ",id,{$id}" : ''), 'image' => 'max:1000|image'];
 }
开发者ID:JolitaGrazyte,项目名称:intoBelgium,代码行数:12,代码来源:UpdateProfileRequest.php

示例9: getRegister

 /**
  * Show the application registration form.
  *
  * @return \Illuminate\Http\Response
  */
 public function getRegister()
 {
     if (\Request::ajax()) {
         return response()->json(['locale' => session()->get('locale', 'nl'), 'url' => \Request::url(), 'title' => 'Register | De Sessie', 'type' => 'pageload', 'path' => \Request::path(), 'view' => view('auth.register')->render()]);
     }
     return view('auth.register');
 }
开发者ID:jonasvanderhaegen,项目名称:Billboa,代码行数:12,代码来源:RegistersUsers.php

示例10: create

 public function create()
 {
     if (\Request::ajax()) {
         return response()->json(['url' => \Request::url(), 'title' => 'Contact | Jonas Vanderhaegen', 'path' => \Request::path(), 'view' => view('pages.messages.create')->render()]);
     }
     return view('pages.messages.create');
 }
开发者ID:jonasvanderhaegen,项目名称:jonasvanderhaegen.be,代码行数:7,代码来源:ContactController.php

示例11: getMod

 public function getMod($slug)
 {
     $table_javascript = route('tdf_name', ['modmodpacks', '0', $slug]);
     $mod = Mod::where('slug', '=', $slug)->first();
     if (!$mod) {
         $redirect = new URLRedirect();
         $do_redirect = $redirect->getRedirect(Request::path());
         if ($do_redirect) {
             return Redirect::to($do_redirect->target, 301);
         }
         App::abort(404);
     }
     $can_edit = false;
     if (Auth::check()) {
         $maintainer = $mod->maintainers()->where('user_id', Auth::id())->first();
         if ($maintainer) {
             $can_edit = true;
         }
     }
     $authors = $mod->authors;
     $spotlights = $mod->youtubeVideos()->where('category_id', 2)->get();
     $tutorials = $mod->youtubeVideos()->where('category_id', 3)->get();
     $raw_links = ['website' => $mod->website, 'download_link' => $mod->download_link, 'donate_link' => $mod->donate_link, 'wiki_link' => $mod->wiki_link];
     $links = [];
     foreach ($raw_links as $index => $link) {
         if ($link != '') {
             $links["{$index}"] = $link;
         }
     }
     $markdown_html = Parsedown::instance()->setBreaksEnabled(true)->text(strip_tags($mod->description));
     $mod_description = str_replace('<table>', '<table class="table table-striped table-bordered">', $markdown_html);
     $title = $mod->name . ' - Mod - ' . $this->site_name;
     $meta_description = $mod->deck;
     return View::make('mods.detail', ['table_javascript' => $table_javascript, 'mod' => $mod, 'mod_description' => $mod_description, 'links' => $links, 'authors' => $authors, 'title' => $title, 'meta_description' => $meta_description, 'sticky_tabs' => true, 'spotlights' => $spotlights, 'tutorials' => $tutorials, 'can_edit' => $can_edit]);
 }
开发者ID:helkarakse,项目名称:modpackindex,代码行数:35,代码来源:ModController.php

示例12: getBreadcrumb

 public function getBreadcrumb()
 {
     $activeSection = '';
     if (Request::path() == 'about') {
         $activeSection = "เกี่ยวกับสารานุกรมกว๊านพะเยา";
     } elseif (Request::path() == 'general') {
         $activeSection = "ข้อมูลทั่วไปกว๊านพะเยา";
     } elseif (Request::path() == 'ecology') {
         $activeSection = "นิเวศวิทยาและสิ่งแวดล้อม";
     } elseif (Request::path() == 'travel') {
         $activeSection = "เศรษฐกิจและการท่องเที่ยว";
     } elseif (Request::path() == 'water-resources') {
         $activeSection = "การจัดการทรัพยากรธรรมชาติ";
     } elseif (Request::path() == 'history') {
         $activeSection = "ประวัติศาสตร์และวัฒนธรรม";
     } elseif (Request::path() == 'register' || Request::path() == 'register/profile' || Request::path() == 'register/account') {
         $activeSection = "ลงทะเบียน";
     }
     if ($activeSection == '') {
         $showBreadcrumb = false;
     } else {
         $showBreadcrumb = true;
     }
     View::share('activeSection', $activeSection);
     View::share('showBreadcrumb', $showBreadcrumb);
 }
开发者ID:eragon011,项目名称:kwanphayao,代码行数:26,代码来源:HomeController.php

示例13: setActive

function setActive($path, $strict = false, $active = 'active')
{
    if ($strict) {
        return Request::is($path) ? $active : '';
    }
    return strpos(Request::path(), $path) !== false ? $active : '';
}
开发者ID:unknowncoders,项目名称:plPredict,代码行数:7,代码来源:helpers.php

示例14: handleRequest

 public function handleRequest()
 {
     // TODO create "page not found" page
     $uri = Request::path();
     // Default version of the documentation
     $page = 'introduction';
     $versions = array("4.0", "4.1", "4.2", "4.3", "4.6", "5.0", "5.6", "5.12");
     $version = end($versions);
     // If not the root, then split the uri to find the content
     $segment1 = Request::segment(1);
     $segment2 = Request::segment(2);
     if (!empty($segment1)) {
         $version = $segment1;
         if (!empty($segment2)) {
             $page = $segment2;
         }
     }
     // Show the correct markdown contents
     $page = __DIR__ . '/docs/' . $version . '/' . $page . '.md';
     if (file_exists($page)) {
         $contents = file_get_contents($page);
         $sidebar = file_get_contents(__DIR__ . '/docs/' . $version . '/sidebar.md');
         // Transform documents
         $contents_html = Markdown::defaultTransform($contents);
         $sidebar_html = Markdown::defaultTransform($sidebar);
         // Replace url variable
         $sidebar_html = preg_replace('/{url}/mi', URL::to($version), $sidebar_html);
         return View::make('layouts.master')->with('version', $version)->with('versions', $versions)->with('sidebar', $sidebar_html)->with('content', $contents_html);
     } else {
         \App::abort(400, "The page you were looking for could not be found.");
     }
 }
开发者ID:rossjones,项目名称:docs,代码行数:32,代码来源:HomeController.php

示例15: my_schedule

 public function my_schedule()
 {
     if (Auth::check()) {
         $data["inside_url"] = Config::get('app.inside_url');
         $data["user"] = Session::get('user');
         $data["actions"] = Session::get('actions');
         if (in_array('side_mi_horario', $data["actions"])) {
             $current_ay = AcademicYear::getCurrentAcademicYear();
             if (!$current_ay) {
                 return View::make('schedule/academic_year_error', $data);
             }
             $student = $data["user"]->student;
             $data["enrollment_info"] = $student->getCurrentEnrollment();
             $data["level"] = $data["enrollment_info"]->level;
             $data["schedules_data"] = $data["level"]->schedules()->orderBy('initial_hour')->get();
             return View::make('schedule/my_schedule', $data);
         } else {
             // Llamo a la función para registrar el log de auditoria
             $log_description = "Se intentó acceder a la ruta '" . Request::path() . "' por el método '" . Request::method() . "'";
             Helpers::registerLog(10, $log_description);
             Session::flash('error', 'Usted no tiene permisos para realizar dicha acción.');
             return Redirect::to('/dashboard');
         }
     } else {
         return View::make('error/error');
     }
 }
开发者ID:damv93,项目名称:trecedemayolaravel,代码行数:27,代码来源:ScheduleController.php


注:本文中的Request::path方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。