===========================================================================
 Option methods
===========================================================================
 @route_priority 1
 @route GET /admin/variants/:field-options
431355
def admin_options
      if !user_is_allowed('variants', 'edit')
        render :json => false
        return
      end
      
      options = []
      case params[:field]                
        when 'subscription-interval'
          options = [
            { 'value' => Variant::SUBSCRIPTION_INTERVAL_MONTHLY , 'text' => 'Monthly' },
            { 'value' => Variant::SUBSCRIPTION_INTERVAL_YEARLY  , 'text' => 'Yearly'  }
          ]                      
        when 'subscription-prorate-method'
          options = [
            { 'value' => Variant::SUBSCRIPTION_PRORATE_METHOD_FLAT       , 'text' => 'Flat Amount'            },
            { 'value' => Variant::SUBSCRIPTION_PRORATE_METHOD_PERCENTAGE , 'text' => 'Percentage of Interval' },
            { 'value' => Variant::SUBSCRIPTION_PRORATE_METHOD_CUSTOM     , 'text' => 'Custom'                 }
          ]
        when 'subscription-start-day'
          options = (1..31).collect{ |i| { 'value' => i, 'text' => i }}            
        when 'subscription-start-month'    
          options = (1..12).collect{ |i| { 'value' => i, 'text' => Date.new(2000, i, 1).strftime('%B') }}
        when 'status'
          options = [
            { 'value' => Variant::STATUS_ACTIVE   , 'text' => 'Active'   },
            { 'value' => Variant::STATUS_INACTIVE , 'text' => 'Inactive' },
            { 'value' => Variant::STATUS_DELETED  , 'text' => 'Deleted'  }
          ]
      end
      render :json => options
    end
644300
public function indexUrl()
    {
        $route = 'admin::index-'.$this->getTable();
        if (Route::has($route)) {
            return route($route);
        }

        return route('dashboard');
    }
1242843
public function index()
    {
        $configurations = Configuration::all();
        $configurations_by_sections = ['init' => [], 'email' => [], 'tickets' => [], 'perms' => [], 'editor' => [], 'other' => []];
        $init_section = ['main_route', 'main_route_path', 'admin_route', 'admin_route_path', 'master_template', 'bootstrap_version', 'routes'];
        $email_section = ['status_notification', 'comment_notification', 'queue_emails', 'assigned_notification',
        'email.template', 'email.header', 'email.signoff', 'email.signature', 'email.dashboard',
        'email.google_plus_link', 'email.facebook_link', 'email.twitter_link', 'email.footer', 'email.footer_link',
        'email.color_body_bg', 'email.color_header_bg', 'email.color_content_bg', 'email.color_footer_bg',
        'email.color_button_bg', ];
        $tickets_section = ['default_status_id', 'default_close_status_id', 'default_reopen_status_id', 'paginate_items'];
        $perms_section = ['agent_restrict', 'close_ticket_perm', 'reopen_ticket_perm'];
        $editor_section = ['editor_enabled', 'include_font_awesome', 'editor_html_highlighter', 'codemirror_theme',
          'summernote_locale', 'summernote_options_json_file', 'purifier_config', ];

        // Split them into configurations sections for tabs
        foreach ($configurations as $config_item) {
            //trim long values (ex serialised arrays)
            $config_item->value = $config_item->getShortContent(25, 'value');
            $config_item->default = $config_item->getShortContent(25, 'default');

            if (in_array($config_item->slug, $init_section)) {
                $configurations_by_sections['init'][] = $config_item;
            } elseif (in_array($config_item->slug, $email_section)) {
                $configurations_by_sections['email'][] = $config_item;
            } elseif (in_array($config_item->slug, $tickets_section)) {
                $configurations_by_sections['tickets'][] = $config_item;
            } elseif (in_array($config_item->slug, $perms_section)) {
                $configurations_by_sections['perms'][] = $config_item;
            } elseif (in_array($config_item->slug, $editor_section)) {
                $configurations_by_sections['editor'][] = $config_item;
            } else {
                $configurations_by_sections['other'][] = $config_item;
            }
        }

        return view('ticketit::admin.configuration.index', compact('configurations', 'configurations_by_sections'));
    }
386868
function route(
    $path = '/', $actions, $method = Router::ANY_METHOD, $name = null, array $filters = [], array $events = []
    )
    {
        if (is_array($path)) {
            foreach ($path as $p) {
                $this->collection[$name ?: count($this->collection)] = (new Route($this->Parser))
                        ->route($p, is_array($actions) ? $actions : [$actions], $method, $name, $filters, $events);
            }
        } else {
            $this->collection[$name ?: count($this->collection)] = (new Route($this->Parser))
                    ->route($path, is_array($actions) ? $actions : [$actions], $method, $name, $filters, $events);
        }

        return $this;
    }
1121056
public static function routes()
  {
    Route::group(['namespace' => 'Auth'], function () {

      Route::group(['middleware' => ['guest']], function () {

        Route::get('login', 'LoginController@showLoginPage')->name('showLogin');
        Route::post('login', 'LoginController@login')->name('login');

        Route::get('login/email', 'LoginController@showMagicLinkPage')->name('showMagicLink');
        Route::post('login/email', 'LoginController@loginWithEmail')->name('loginWithEmail');
        Route::get('login/callback/email/', 'LoginController@loginEmailCallback')->name('loginCallback');

        Route::get('register', 'RegisterController@showRegistrationPage')->name('showRegistration');
        Route::post('register', 'RegisterController@register')->name('register');

        Route::get('password/forgot', 'ForgotPasswordController@showForgotPasswordPage')->name('showForgotPassword');
        Route::post('password/forgot', 'ForgotPasswordController@forgot')->name('forgot');

        Route::get('password/reset', 'ForgotPasswordController@showResetPasswordPage')->name('showResetPassword');
        Route::post('password/reset', 'ForgotPasswordController@resetPassword')->name('resetPassword');

      });

      Route::get('logout', 'LoginController@logout')->name('logout')->middleware('private', 'auth');
      Route::get('account/verify', 'RegisterController@verifyEmail')->name('verify');

    });
  }
388961
def edit(options = { only: [], except: [:id, :created_at, :updated_at], required: [] })
      @required_keys = options[:required]
      @attrs = CEO::Iterator.filter(@thing.attributes.keys, options)
      @model = @thing.model_name.name.constantize
      @route_name ||= @controller_name ||= controller_name
      @index_route = send(:"admin_#{@route_name}_path")

      render 'admin/edit'
    end
618777
public function getOptionRoutes()
    {
        $cached = $this->cacheProvider->fetch('cached_restutils_route_options');
        if ($cached) {
            return $cached;
        }
        $ret = array_filter(
            $this->router->getRouteCollection()->all(),
            function ($route) {
                if (!in_array('OPTIONS', $route->getMethods())) {
                    return false;
                }
                // ignore all schema routes
                if (strpos($route->getPath(), '/schema') === 0) {
                    return false;
                }
                if ($route->getPath() == '/' || $route->getPath() == '/core/version') {
                    return false;
                }

                return is_null($route->getRequirement('id'));
            }
        );
        $this->cacheProvider->save('cached_restutils_route_options', $ret);
        return $ret;
    }
1337886
public function getRoute() {
        $this->prepareServerUrl();
        $requestUrl = $this->server . 'viaroute?';
        if(func_num_args() < 2) {
            throw new OsrmException('A minimum of two arguments must be provided.', 2);
        }
        
        for($j = 0; $j < func_num_args(); $j++) {
            $coord = func_get_arg($j);
            
            if($coord instanceof Coordinate) {
                 if($j != 0) {
                     $requestUrl = $requestUrl . '&';
                 }
                 $requestUrl = $requestUrl . $coord;
            }
        }
        
        $curl = curl_init();
        curl_setopt_array($curl, array(
           CURLOPT_RETURNTRANSFER => 1,
           CURLOPT_URL => $requestUrl,
        ));
        
        $resp = curl_exec($curl);
        curl_close($curl);
        
        $json = json_decode($resp);
              
        if($json->status === 0) {
            $route = new Route();
            $route->setEndPoint($json->route_summary->end_point);
            $route->setStartPoint($json->route_summary->start_point);
            $route->setTotalTime($json->route_summary->total_time);
            $route->setTotalDistance($json->route_summary->total_distance);
            $route->setRouteGeometry($json->route_geometry);
            
            $instructionsJson = $json->route_instructions;
            $instructions = array();
            foreach($instructionsJson as $instrObj) {
                $instruction = new DrivingInstruction();
                $instruction->setTurnInstruction($instrObj[0]);
                $instruction->setWayName($instrObj[1]);
                $instruction->setLength($instrObj[2]);
                $instruction->setPosition($instrObj[3]);
                $instruction->setTime($instrObj[4]);
                $instruction->setLengthUnit($instrObj[5]);
                $instruction->setDirection($instrObj[6]);
                $instruction->setAzimuth($instrObj[7]);
                array_push($instructions, $instruction);
            }
            $route->setRouteInstructions($instructions);
            
            return $route;
        } else {
            throw new OsrmException("Osrm status error", $json->{'status'});
            return null;
        }
    }
185935
public function map()
    {
        Route::namespace($this->namespace)->group(function (Router $router) {

            /*
             * Admin routes
             */
            $router->middleware('admin')->prefix('admin')->group(function (Router $router) {
                $router->get('pages', 'AdminController@index')->name('admin::index-pages')->middleware('can:see-all-pages');
                $router->get('pages/create', 'AdminController@create')->name('admin::create-page')->middleware('can:create-page');
                $router->get('pages/{page}/edit', 'AdminController@edit')->name('admin::edit-page')->middleware('can:update-page');
                $router->post('pages', 'AdminController@store')->name('admin::store-page')->middleware('can:create-page');
                $router->put('pages/{page}', 'AdminController@update')->name('admin::update-page')->middleware('can:update-page');

                $router->get('pages/{page}/sections/create', 'SectionsAdminController@create')->name('admin::create-page_section')->middleware('can:create-page_section');
                $router->get('pages/{page}/sections/{section}/edit', 'SectionsAdminController@edit')->name('admin::edit-page_section')->middleware('can:update-page_section');
                $router->post('pages/{page}/sections', 'SectionsAdminController@store')->name('admin::store-page_section')->middleware('can:create-page_section');
                $router->put('pages/{page}/sections/{section}', 'SectionsAdminController@update')->name('admin::update-page_section')->middleware('can:update-page_section');
                $router->post('pages/{page}/sections/sort', 'SectionsAdminController@sort')->name('admin::sort-page_sections');

                $router->get('sections', 'SectionsAdminController@index')->name('admin::index-page_sections')->middleware('can:see-all-page_sections');
                $router->delete('sections/{section}', 'SectionsAdminController@destroyMultiple')->name('admin::destroy-page_section')->middleware('can:delete-page_section');
            });

            /*
             * API routes
             */
            $router->middleware('api')->prefix('api')->group(function (Router $router) {
                $router->middleware('auth:api')->group(function (Router $router) {
                    $router->get('pages', 'ApiController@index')->middleware('can:see-all-pages');
                    $router->patch('pages/{page}', 'ApiController@updatePartial')->middleware('can:update-page');
                    $router->post('pages/sort', 'ApiController@sort')->middleware('can:update-page');
                    $router->delete('pages/{page}', 'ApiController@destroy')->middleware('can:delete-page');

                    $router->get('pages/{page}/files', 'ApiController@files')->middleware('can:update-page');
                    $router->post('pages/{page}/files', 'ApiController@attachFiles')->middleware('can:update-page');
                    $router->delete('pages/{page}/files/{file}', 'ApiController@detachFile')->middleware('can:update-page');

                    $router->get('pages/{page}/sections', 'SectionsApiController@index')->middleware('can:see-all-page_sections');
                    $router->patch('pages/{page}/sections/{section}', 'SectionsApiController@updatePartial')->middleware('can:update-page_section');
                    $router->delete('pages/{page}/sections/{section}', 'SectionsApiController@destroy')->middleware('can:delete-page_section');

                    $router->get('page_sections/{section}/files', 'SectionsApiController@files')->middleware('can:update-page_section');
                    $router->post('page_sections/{section}/files', 'SectionsApiController@attachFiles')->middleware('can:update-page_section');
                    $router->delete('page_sections/{section}/files/{file}', 'SectionsApiController@detachFile')->middleware('can:update-page_section');
                });
            });

            /*
             * Front office routes
             */
            $router->middleware('public')->group(function (Router $router) {
                if (config('typicms.main_locale_in_url')) {
                    if (config('typicms.lang_chooser')) {
                        $router->get('/', 'PublicController@langChooser');
                    } else {
                        $router->get('/', 'PublicController@redirectToHomepage');
                    }
                }
                foreach (locales() as $locale) {
                    if (
                        config('app.fallback_locale') != $locale ||
                        config('typicms.main_locale_in_url')
                    ) {
                        $router->prefix($locale)->get('{uri}', 'PublicController@uri')->where('uri', '(.*)');
                    }
                }
                $router->get('{uri}', 'PublicController@uri')->where('uri', '(.*)');
            });
        });
    }
358529
public function route()
    {
        $this->dashboardRouting($this->relativeCmsUri);
        $this->logOffRouting($this->request, $this->relativeCmsUri);
        $this->apiRouting($this->relativeCmsUri);
        $this->documentRouting($this->userRights, $this->relativeCmsUri);
        $this->valuelistsRouting($this->userRights, $this->relativeCmsUri);
        $this->sitemapRouting($this->userRights, $this->relativeCmsUri);
        $this->redirectRouting($this->userRights, $this->relativeCmsUri);
        $this->imageRouting($this->userRights, $this->relativeCmsUri);
        $this->filesRouting($this->userRights, $this->relativeCmsUri);
        $this->configurationRouting($this->userRights, $this->relativeCmsUri);
        $this->searchRouting($this->relativeCmsUri);
    }
505253
public function findRoute() {
        if (isset($_SERVER['REQUEST_URI'])) {

            $matched_uris = array();
            $routes_group = array();
            $request_uri = preg_replace('/[?]/', '', $_SERVER['REQUEST_URI']);

            foreach ($this->routes as $route) {
                if (trim(urldecode($request_uri), '/') == $route['uri']) {
                    $matched_uris[] = $route['uri'];
                    $route['args'] = [];
                    array_push($routes_group, $route);
                }
            }

            if (!$matched_uris) {
                foreach ($this->routes as $route) {
                    $route['uri'] = str_replace('/', '\/', $route['uri']);
                    $route['uri'] = preg_replace_callback('/\[(:num)(:([0-9]+))*\](\?)?/', array($this, 'findPattern'), $route['uri']);
                    $route['uri'] = preg_replace_callback('/\[(:alpha)(:([0-9]+))*\](\?)?/', array($this, 'findPattern'), $route['uri']);
                    $route['uri'] = preg_replace_callback('/\[(:any)(:([0-9]+))*\](\?)?/', array($this, 'findPattern'), $route['uri']);

                    $request_uri = parse_url($_SERVER['REQUEST_URI']);

                    preg_match("/^\/" . $route['uri'] . "$/u", urldecode($request_uri['path']), $matches);

                    if ($matches) {
                        array_push($matched_uris, $matches[0]);
                        array_shift($matches);

                        $route['args'] = $matches;
                        array_push($routes_group, $route);
                    }
                }
            }

            if (!$matched_uris) {
                self::$currentRoute = NULL;
                HookManager::call('pageNotFound');
            }

            if ($matched_uris) {
                if (count($routes_group) > 1) {

                    self::$currentModule = $routes_group[0]['module'];

                    for ($i = 0; $i < count($routes_group) - 1; $i++) {
                        for ($j = $i + 1; $j < count($routes_group); $j++) {
                            if ($routes_group[$i]['method'] == $routes_group[$j]['method']) {
                                self::$currentRoute = NULL;
                                throw new RouteException(_message(ExceptionMessages::REPETITIVE_ROUTE_SAME_METHOD, $routes_group[$j]['method']));
                                break 2;
                            }
                            if ($routes_group[$i]['module'] != $routes_group[$j]['module']) {
                                self::$currentRoute = NULL;
                                throw new RouteException(ExceptionMessages::REPETITIVE_ROUTE_DIFFERENT_MODULES);
                                break 2;
                            }
                        }
                    }

                    foreach ($routes_group as $route) {
                        if (strpos($route['method'], '|') !== false) {
                            if (in_array($_SERVER['REQUEST_METHOD'], explode('|', $route['method']))) {
                                self::$currentRoute = $route;
                                break;
                            }
                        } else if ($_SERVER['REQUEST_METHOD'] == $route['method']) {
                            self::$currentRoute = $route;
                            break;
                        }
                    }
                } else {
                    self::$currentModule = $routes_group[0]['module'];
                    self::$currentRoute = $routes_group[0];
                }
            }

            HookManager::call('handleHeaders');

            if ($_SERVER['REQUEST_METHOD'] != 'OPTIONS') {
                $this->checkMethod();
            }
        }
    }
1355324
public function parsePostRoute()
    {
        if (empty($this->routes) || ! isset($this->routes['post'])) {
            return;
        }

        foreach ($this->routes['post'] as $action => $callback) {
            $this->action->add('admin_post_'.$action, $callback);
        }
    }
301834
public function generateAdminPath(
        $admin,
        $actionCode,
        array $parameters = [],
        $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH
    ): string {
        $admin = $this->getAdmin($admin);
        $action = $admin->getAction($actionCode);

        $missingParams = $this->computeMissingRouteParameters($action->getRoute(), $parameters);
        foreach ($missingParams as $missingParam) {
            if ($this->router->getContext()->hasParameter($missingParam)) {
                $parameters[$missingParam] = $this->router->getContext()->getParameter($missingParam);
            }
        }

        return $this->router->generate($action->getRouteName(), $parameters, $referenceType);
    }
1214237
private function mapAdminRoutes()
    {
        $this->name('backups.')
            ->prefix($this->config()->get('arcanesoft.backups.route.prefix', 'backups'))
            ->group(function () {
                Routes\StatusesRoutes::register();
            });
    }
781731
function adminRender()
    {
        if (UserRights($this->access))
        {
            $result = '';
            if (arg('update'))
            {
                $this->update();
            }
            elseif (arg('action'))
            {
                switch (arg('action'))
                {
                    case 'up':
                        $this->moveUp();
                        break;
                    case 'down':
                        $this->moveDown();
                        break;
                    case 'create':
                        $result = $this->create();
                        break;
                    case 'insert':
                        $this->insert();
                        break;
                    case 'move':
                        $result = $this->move();
                        break;
                    case 'delete':
                        $this->delete();
                        break;
                }
            }
            elseif (isset(Eresus_CMS::getLegacyKernel()->request['arg']['id']))
            {
                $result = $this->edit(arg('id', 'int'));
            }
            else
            {
                $result = $this->sectionIndex();
            }
            return $result;
        }
        else
        {
            return '';
        }
    }
1066834
public function getOptions(){
		if(null === $this->options){
			$routeMatch = $this->getEvent()->getRouteMatch();
			$privilege = $routeMatch->getParam('xelax_admin_privilege');
			if(empty($privilege)){
				throw new Exception('XelaxAdmin\Router\ListRoute route required');
			}
			
			$options = $this->getServiceLocator()->get('XelaxAdmin\ListControllerOptions');
			$activeOption = null;
			$parts = explode('/', $privilege);
			$action = array_pop($parts);
			foreach ($parts as $part){
				if(array_key_exists($part, $options)){
					$activeOption = $options[$part];
					$options = $activeOption->getChildOptions();
				} else {
					throw new Exception("Active ListControllerOptions not found");
				}
			}
			
			if(empty($activeOption)){
				throw new Exception("Active ListControllerOptions not found");
			}
			
			$this->options = $activeOption;
		}
		return $this->options;
	}
718001
public function getAdminWrapperAction()
    {
        $allowed = $this->cmsPermissionChecks->siteAdminCheck($this->currentSite);

        if (!$allowed) {
            return null;
        }

        /** @var RouteMatch $routeMatch */
        $routeMatch = $this->getEvent()->getRouteMatch();
        $siteId = $this->currentSite->getSiteId();
        $sourcePageName = $routeMatch->getParam('page', 'index');

        if ($sourcePageName instanceof Page) {
            $sourcePageName = $sourcePageName->getName();
        }

        $pageType = $routeMatch->getParam('pageType', 'n');

        $view = new ViewModel();
        $view->setVariable('restrictions', false);
        if ($this->cmsPermissionChecks->isPageRestricted($siteId, $pageType, $sourcePageName, 'read') == true) {
            $view->setVariable('restrictions', true);
        }

        $view->setVariable('adminMenu', $this->adminPanelConfig);
        $view->setTemplate('rcm-admin/admin/admin');

        return $view;
    }