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


PHP Route::is方法代码示例

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


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

示例1: set_active

/**
 * @param $routes
 * @param string $active
 * @return string
 */
function set_active($routes = [], $active = 'active')
{
    foreach ($routes as $route) {
        if (Route::is($route)) {
            return $active;
        }
    }
}
开发者ID:rdok,项目名称:oblivion-pm,代码行数:13,代码来源:helpers.php

示例2: activate

/**
 * @param array $routes
 * @param string $active
 * @return string|void
 */
function activate($routes = [], $active = 'active')
{
    foreach ($routes as $route) {
        if (Route::is($route)) {
            return $active;
        }
    }
    return;
}
开发者ID:Hub-IT,项目名称:gazette,代码行数:14,代码来源:helpers.php

示例3: active_menu

 /**
  * Determine whether the given menu is active based on current route name.
  *
  * @param  string $menu
  * @return boolean
  */
 function active_menu($menu)
 {
     switch ($menu) {
         case 'users':
             return (Route::is('user*') || Route::is('company.user*') || Route::is('role.user*')) && !Route::is('user.process.index');
         case 'roles':
             return (Route::is('role*') || Route::is('company.role*')) && !Route::is('role.user*');
     }
 }
开发者ID:arminsam,项目名称:SimpleUserManagement,代码行数:15,代码来源:helpers.php

示例4: index

 /**
  * Display a listing of tarefas
  *
  * @return Response
  */
 public function index()
 {
     $data = Input::get();
     $data['view'] = Input::has('view') ? Input::get('view') : 'today';
     // today, late, next, done
     $data['paginate'] = Input::has('paginate') ? Input::get('paginate') : 10;
     $dt = new Carbon();
     $tarefas = Tarefa::where(function ($query) use($data, $dt) {
         switch ($data['view']) {
             case 'late':
                 $query->where('date', '<', $dt->format('Y-m-d'))->where('done', false);
                 break;
             case 'next':
                 $query->where('date', '>', $dt->format('Y-m-d'))->where('done', false);
                 break;
             case 'done':
                 $query->where('done', true);
                 break;
             default:
                 // TODAY
                 $query->where('date', '>=', $dt->startOfDay()->format('Y-m-d'))->where('date', '<=', $dt->endOfDay()->format('Y-m-d'));
                 break;
         }
     })->orderBy(Input::get('order_by', 'date'), Input::get('order', 'DESC'))->with('cliente', 'conversas')->paginate(Input::get('paginate', 10));
     // $tarefas = Tarefa::orderBy('date', 'DESC')->with('cliente')->get();
     $hoje = date('Y-m-d');
     $ontem = Carbon::create(date('Y'), date('m'), date('d'))->subDay();
     $amanha = Carbon::create(date('Y'), date('m'), date('d'))->addDay();
     $proximo = Carbon::create(date('Y'), date('m'), date('d'))->addDay();
     //Igual amanhã?
     if ($proximo->isWeekend()) {
         $proximo = new Carbon('next monday');
     }
     $tarefas->pendentes = Tarefa::where('date', '<', $hoje)->where('done', 0)->orderBy('date', 'ASC')->with('cliente', 'conversas')->get();
     $tarefas->hoje = Tarefa::where('date', '<', $amanha->startOfDay())->where('date', '>', $ontem)->where('done', 0)->with('cliente', 'conversas')->get();
     $tarefas->nextDay = Tarefa::where('done', 0)->where('date', '>=', $amanha)->where('date', '<', $proximo->addDay())->orderBy('date', 'DESC')->with('cliente', 'conversas')->get();
     $tarefas->proximas = Tarefa::where('date', '>=', $amanha)->orderBy('date', 'ASC')->where('done', 0)->with('cliente', 'conversas')->get();
     $tarefas->concluidas = Tarefa::where('done', 1)->orderBy('updated_at', 'DESC')->with('cliente', 'conversas')->get();
     $tarefas->days = $tarefas->groupBy(function ($tarefa) {
         return date('Y-m-d', strtotime($tarefa->date));
     });
     if (Request::ajax()) {
         return $tarefas;
     }
     if (Route::is('tarefas.print')) {
         return View::make('tarefas.print', compact('tarefas'));
     } else {
         return View::make('tarefas.index', compact('tarefas'));
     }
 }
开发者ID:waldenylson,项目名称:alfredapp,代码行数:55,代码来源:TarefasController.php

示例5: index

 /**
  * Display a listing of the resource.
  * GET /contacts
  *
  * @return Response
  */
 public function index()
 {
     // $agenda = new CreateAgendaEventsTable;
     // $agenda->down();
     // $agenda->up();
     // exit;
     $data = Input::get();
     $data['view'] = Input::has('view') ? Input::get('view') : 'day';
     $data['date'] = Input::has('date') ? Input::get('date') : date('Y-m-d');
     $data['next'] = Input::has('next') ? Input::get('next') : 0;
     $data['prev'] = Input::has('prev') ? Input::get('prev') : 0;
     $data['type'] = Input::has('type') ? Input::get('type') : NULL;
     $tarefas = array();
     $agendaevents = array();
     if ($data['type'] == 'tarefa' || $data['type'] == NULL) {
         $tarefas = $this->getTarefas($data);
         $tarefas = $tarefas->groupBy(function ($tarefa) {
             return date('Y-m-d', strtotime($tarefa->date));
         })->toArray();
     }
     if ($data['type'] == 'agendaevent' || $data['type'] == NULL) {
         $agendaevents = $this->getAgendaEvents($data);
         $agendaevents = $agendaevents->groupBy(function ($agendaevent) {
             return date('Y-m-d', strtotime($agendaevent->date_start));
         })->toArray();
     }
     // $agendaevents['date_start'] = array_merge($tarefas['date']);
     $events = array_merge_recursive($tarefas, $agendaevents);
     // $events = array_merge($agendaevents);
     ksort($events);
     // print_r( $events );
     $navigation_links = $this->getNavigationLinks($data);
     $labels = $this->getLabels($data);
     if (Route::is('agenda.print')) {
         return View::make('agenda.print', compact('events', 'navigation_links', 'labels', 'carbon'));
     } else {
         return View::make('agenda.index', compact('events', 'navigation_links', 'labels', 'carbon'));
     }
 }
开发者ID:waldenylson,项目名称:alfredapp,代码行数:45,代码来源:AgendaController.php

示例6: isOnPages

 /**
  * @return bool
  */
 function isOnPages()
 {
     return Route::is('admin.pages.*');
 }
开发者ID:itmyprofession,项目名称:admin,代码行数:7,代码来源:helpers.php

示例7: foreach

<?php

$cache_config = File::open(__DIR__ . DS . 'states' . DS . 'config.txt')->unserialize();
$route_cache = false;
if (isset($cache_config['path'][$config->url_path])) {
    $route_cache = $cache_config['path'][$config->url_path];
} else {
    foreach ($cache_config['path'] as $path => $exp) {
        if (Route::is($path)) {
            $route_cache = $exp;
            break;
        }
    }
}
if ($route_cache !== false) {
    Weapon::add('shield_before', function () use($config, $route_cache) {
        $q = !empty($config->url_query) ? '.' . md5($config->url_query) : "";
        $cache = CACHE . DS . str_replace(array('/', ':'), '.', $config->url_path) . $q . '.cache';
        $time = file_exists($cache) ? filemtime($cache) : false;
        if ($time !== false && ($route_cache === true || time() - $route_cache * 60 * 60 < $time)) {
            $content = file_get_contents($cache);
            if (strpos($content, '<?xml ') === 0 || strpos($content, '</html>') !== false) {
                $content .= '<!-- cached: ' . date('Y-m-d H:i:s', $time) . ' -->';
            }
            $content = Filter::apply('cache:input', $content);
            $content = Filter::apply('cache:output', $content);
            echo $content;
            exit;
        }
        Weapon::add('shield_after', function ($G) use($cache) {
            $G['data']['cache'] = $cache;
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:launch.php

示例8: function

| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
    if (Session::token() != Input::get('_token')) {
        throw new Illuminate\Session\TokenMismatchException();
    }
});
Route::filter('manage_topics', function () {
    if (Auth::guest()) {
        return Redirect::guest('login-required');
    } elseif (!Entrust::can('manage_topics')) {
        // Checks the current user
        return Redirect::route('admin-required');
    }
});
Route::filter('manage_users', function () {
    if (Auth::guest()) {
        return Redirect::guest('login-required');
    } elseif (!Entrust::can('manage_users')) {
        // Checks the current user
        return Redirect::route('admin-required');
    }
});
Route::filter('check_banned_user', function () {
    // Check Banned User
    if (Auth::check() && !Route::is('user-banned') && Auth::user()->is_banned) {
        return Redirect::route('user-banned');
    }
});
开发者ID:fcode520,项目名称:phphub,代码行数:31,代码来源:filters.php

示例9: md5

    Weapon::fire(array('on_shield_update', 'on_shield_' . $mode, 'on_shield_' . md5($slug) . '_update', 'on_shield_' . md5($slug) . '_' . $mode), array($G, $G));
    $new_config = Get::state_config();
    $new_config['shield'] = $path === 'attach' ? $slug : 'normal';
    File::serialize($new_config)->saveTo(STATE . DS . 'config.txt', 0600);
    $G = array('data' => array('id' => $slug, 'action' => $path));
    Notify::success(Config::speak('notify_success_updated', $speak->shield));
    foreach (glob(LOG . DS . 'asset.*.log', GLOB_NOSORT) as $asset_cache) {
        File::open($asset_cache)->delete();
    }
    Guardian::kick($config->manager->slug . '/shield/' . $slug);
});
/**
 * Shield Updater (Base)
 * ---------------------
 */
if ($route = Route::is($config->manager->slug . '/shield/(:any)/update')) {
    Weapon::add('routes_before', function () use($config, $speak, $route) {
        if (!Route::accepted($route['path'])) {
            Route::accept($route['path'], function () use($config, $speak, $route) {
                if ($request = Request::post()) {
                    $s = $route['lot'][0];
                    $request = Filter::apply('request:__shield', $request, $s);
                    Guardian::checkToken($request['token']);
                    unset($request['token']);
                    // remove token from request array
                    File::serialize($request)->saveTo(SHIELD . DS . $s . DS . 'states' . DS . 'config.txt', 0600);
                    Notify::success(Config::speak('notify_success_updated', $speak->shield));
                    Guardian::kick(File::D($config->url_current));
                }
            });
        }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:31,代码来源:route.shield.php

示例10: function

/**
 * Custom Function(s)
 * ------------------
 *
 * Add your own custom function(s) here. You can do something like
 * making custom widget(s), custom route(s), custom filter(s),
 * custom weapon(s), loading custom asset(s), etc. So that you can
 * manipulate the site output without having to touch the CMS core.
 *
 */
// HTML output manipulation
Filter::add('chunk:output', function ($content, $path) use($config, $speak) {
    $name = File::N($path);
    // Add an icon to the log in form button
    if ($name === 'page.body' && Route::is($config->manager->slug . '/login')) {
        return str_replace('>' . $speak->login . '</button>', '><i class="fa fa-key"></i> ' . trim(strip_tags($speak->login)) . '</button>', $content);
    }
    // Add an icon to the older and newer link text
    if ($name === 'pager') {
        $content = str_replace('>' . $speak->newer . '</a>', '><i class="fa fa-angle-left"></i> ' . trim(strip_tags($speak->newer)) . '</a>', $content);
        $content = str_replace('>' . $speak->older . '</a>', '>' . trim(strip_tags($speak->older)) . ' <i class="fa fa-angle-right"></i></a>', $content);
    }
    // Add an icon to the article date
    if ($name === 'article.time') {
        $content = str_replace('<time ', '<i class="fa fa-calendar"></i> <time ', $content);
    }
    // Add an icon to the comments title
    if ($name === 'comments.header') {
        $content = str_replace('<h3>', '<h3><i class="fa fa-comments"></i> ', $content);
    }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:30,代码来源:functions.php

示例11: array

        $P = array('data' => array('id' => $slug));
        Weapon::fire(array('on_plugin_update', 'on_plugin_destruct', 'on_plugin_' . md5($slug) . '_update', 'on_plugin_' . md5($slug) . '_destruct'), array($P, $P));
        File::open($plugin)->delete();
        // delete later ...
        Notify::success(Config::speak('notify_success_deleted', $speak->plugin));
        Guardian::kick($config->manager->slug . '/plugin');
    } else {
        Notify::warning(Config::speak('notify_confirm_delete_', '<strong>' . $info['title'] . '</strong>'));
    }
    Shield::lot(array('segment' => 'plugin'))->attach('manager');
});
/**
 * Plugin Updater (Base)
 * ---------------------
 */
if ($route = Route::is($config->manager->slug . '/plugin/(:any)/update')) {
    Weapon::add('routes_before', function () use($config, $speak, $route) {
        if (!Route::accepted($route['path'])) {
            Route::accept($route['path'], function () use($config, $speak, $route) {
                if ($request = Request::post()) {
                    $s = $route['lot'][0];
                    $request = Filter::apply('request:__plugin', $request, $s);
                    Guardian::checkToken($request['token']);
                    unset($request['token']);
                    // remove token from request array
                    File::serialize($request)->saveTo(PLUGIN . DS . $s . DS . 'states' . DS . 'config.txt', 0600);
                    Notify::success(Config::speak('notify_success_updated', $speak->plugin));
                    Guardian::kick(File::D($config->url_current));
                }
            });
        }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:31,代码来源:route.plugin.php

示例12: on_route

 function on_route($route)
 {
     return Route::current() ? Route::is($route) : false;
 }
开发者ID:jimmitjoo,项目名称:Core,代码行数:4,代码来源:helpers.php

示例13: str_replace

    $name = File::N($path);
    // Add an icon to the older and newer link text
    if ($name === 'pager') {
        $content = str_replace('>' . $speak->newer . '</a>', '><i class="fa fa-angle-left"></i> ' . trim(strip_tags($speak->newer)) . '</a>', $content);
        $content = str_replace('>' . $speak->older . '</a>', '>' . trim(strip_tags($speak->older)) . ' <i class="fa fa-angle-right"></i></a>', $content);
    }
    // Add an icon to the article date
    if ($name === 'article.time') {
        $content = str_replace('<time ', '<i class="fa fa-calendar"></i> <time ', $content);
    }
    // Add an icon to the comments title
    if ($name === 'comments.header') {
        $content = str_replace('<h3>', '<h3><i class="fa fa-comments"></i> ', $content);
    }
    // Add an icon to the comment form button
    if ($name === 'comment.form') {
        $content = str_replace('>' . $speak->publish . '</button>', '><i class="fa fa-check-circle"></i> ' . trim(strip_tags($speak->publish)) . '</button>', $content);
    }
    // Add an icon to the log in/out link
    if ($name === 'block.footer.bar') {
        $content = str_replace('>' . $speak->log_in . '</a>', '><i class="fa fa-sign-in"></i> ' . trim(strip_tags($speak->log_in)) . '</a>', $content);
        $content = str_replace('>' . $speak->log_out . '</a>', '><i class="fa fa-sign-in"></i> ' . trim(strip_tags($speak->log_out)) . '</a>', $content);
    }
    // Add an icon to the log in form button
    if (Route::is($config->manager->slug . '/login') && $name === 'page.body') {
        return str_replace('>' . $speak->login . '</button>', '><i class="fa fa-key"></i> ' . trim(strip_tags($speak->login)) . '</button>', $content);
    }
    return $content;
});
// Exclude these fields on index, tag, archive, search page ...
Config::set($config->page_type . '_fields_exclude', array('content', 'content_raw'));
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:functions.php

示例14: active_route

 /**
  * Return the "active" class if current route is matched.
  *
  * @param  string|array $route
  * @param  string $output
  * @return string|null
  */
 function active_route($route, $output = 'active')
 {
     if (is_array($route)) {
         if (call_user_func_array('Route::is', $route)) {
             return $output;
         }
     } else {
         if (Route::is($route)) {
             return $output;
         }
     }
 }
开发者ID:jenky,项目名称:laravel-api-starter,代码行数:19,代码来源:helpers.php

示例15: array

Route::get('cart', 'PaymentController@index');
Route::get('cart/remove/event/{id}', 'PaymentController@removeEventCart');
Route::post('cart/add/event/{id}', 'PaymentController@addEventCart');
Route::get('cart/select', array('before' => 'auth', 'as' => 'checkout.select', 'uses' => 'PaymentController@selectplayer'));
Route::post('cart/select/{id}', array('before' => 'auth', 'as' => 'checkout.select.addplayer', 'uses' => 'PaymentController@addplayertocart'));
Route::delete('cart/select/{id}', array('before' => 'auth', 'as' => 'checkout.select.removeplayer', 'uses' => 'PaymentController@removeplayertocart'));
Route::get('checkout', array('before' => 'auth', 'as' => 'checkout', 'uses' => 'PaymentController@create'));
Route::get('checkout/success', array('before' => 'auth', 'as' => 'checkout.success', 'uses' => 'PaymentController@success'));
Route::post('checkout/store', array('before' => 'auth', 'as' => 'checkout.store', 'uses' => 'PaymentController@store'));
Route::post('checkout/validate', array('before' => 'auth', 'as' => 'checkout.validate', 'uses' => 'PaymentController@validate'));
Route::post('checkout/discount', array('before' => 'auth', 'as' => 'checkout.discount', 'uses' => 'DiscountController@validate'));
//Helper API
Route::post('api/image/upload', 'ImageController@upload');
Route::post('api/image/crop', 'ImageController@crop');
Route::get('api/ical/create/{id}', 'CalendarController@create');
Route::get('api/export/team/{id}', array('before' => 'auth', 'uses' => 'ExportController@team'));
Route::get('api/export/event/{id}', array('before' => 'auth', 'uses' => 'ExportController@event'));
Route::post('api/export/report/', array('before' => 'auth', 'uses' => 'ExportController@report'));
Route::post('api/queue/push', function () {
    return Queue::marshal();
});
//** smart link macro **//
HTML::macro('smart_link', function ($route) {
    if (Route::is($route) or Request::is($route)) {
        $active = "selected";
    } else {
        $active = '';
    }
    return $active;
});
App::bind('confide.user_validator', 'UserValidation');
开发者ID:illuminate3,项目名称:league-production,代码行数:31,代码来源:routes.php


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