public function page($page = FALSE) { if ($locale = Cookie::get('locale')) { App::setLocale($locale); } if (!$page) { return Redirect::to(Lang::get('navigation.consumer'), 301); } $nav = array(); foreach (['consumer', 'exporter'] as $item) { $loc = Lang::get('navigation.' . $item); $link = strtolower(str_replace(' ', '-', $loc)); if ($link == $page) { $page = $item; } $nav[$link] = ucfirst($loc); } if (!View::exists('layouts.public.' . $page)) { App::abort(404); } $sub_nav = array(); $view = View::make('layouts.public.' . $page); switch ($page) { case 'exporter': $sub_nav = ['assortment', 'horticulture', 'certification', 'contact']; $picturebox = new Picturebox\PictureboxManager(); $view->with('picturebox', $picturebox); break; } $view->with('sub_nav', $sub_nav); return $view->with('nav', $nav); }
public function action_index($modelName) { $model = $this->getClassObject($modelName); $columnModel = $model::first(); Input::flash(); if (Input::get($modelName) != null && $this->addConditions($model, $modelName)->first() != null) { $columnModel = $this->addConditions($model, $modelName)->first(); } if ($columnModel == null) { return Redirect::to("/lara_admin/models/{$modelName}/new"); } $columns = $columnModel->columns(); $sort_options = $this->setOrderOptions($columns); $models = $this->addConditions($model, $modelName)->order_by($sort_options["column_order"], $sort_options["sort_direction"])->paginate($model->perPage); $request_uri = Request::server("REQUEST_URI"); $request_uri = preg_replace("/&order=[^&]*/", "", $request_uri); if (!preg_match("/\\?/i", Request::server("REQUEST_URI"))) { $request_uri .= "?"; } //TODO function getCustomAction $name_custom_action = "lara_admin::" . Str::plural(Str::lower($modelName)) . "." . preg_replace("/action_/", "", __FUNCTION__); if (View::exists($name_custom_action) != false) { $view = View::make($name_custom_action, array("sort_options" => $sort_options, "request_uri" => $request_uri, "modelName" => $modelName, "modelInstance" => $model, "models" => $models, "columns" => $columns)); } else { $view = View::make("lara_admin::models.index", array("sort_options" => $sort_options, "request_uri" => $request_uri, "modelName" => $modelName, "modelInstance" => $model, "models" => $models, "columns" => $columns)); } $this->defaultAttrForLayout($modelName, $view); return $this->response_with(array("xml", "json", "csv"), $this->collectionToArray($models->results), true); }
/** * Makes view * * @param string $viewName * @param array $data * @param string $controller * * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory */ public function view($viewName, array $data = [], $controller = "") { foreach ($this->beforeRender as $method) { $this->{$method}($viewName, $data, $controller); } \View::share("__siteTitle", $this->title); \View::share("__siteDescription", $this->description); \View::share("__siteKeywords", $this->keywords); \View::share("__bodyId", $this->bodyId); \View::share("__bodyClass", $this->bodyClass); \View::share("__styles", $this->styles); \View::share("__scripts", $this->scripts); $rc = new \ReflectionClass($this); $className = str_replace(\App::getNamespace() . "Http\\Controllers\\", "", $rc->getName()); \View::share("__controller", $controller ? $controller : "{$className}::{$viewName}"); if ($this->viewPrefix) { $nbView = $this->viewPrefix . '.' . $viewName; } else { $nbView = 'controllers.' . str_replace("\\", ".", $className) . '.' . $viewName; } if (\View::exists($nbView)) { $viewName = $nbView; } if (!empty($this->formData)) { if ($this->oldInputHasPriority) { $this->request()->session()->flashInput(array_merge($this->formData, $this->request()->old(null, []))); } else { $this->request()->session()->flashInput($this->request()->old(null, []), $this->formData); } } return view($viewName, $this->viewData, $data); }
/** * Display the specified resource. * * @param int $id */ public function show($id) { // if exist external content then send it to browser, increment views $external_content = $this->showPage->checkAndGetContentFromHtmlFile(app('veer')->siteId, $id); if (!empty($external_content)) { \Veer\Models\Page::where('id', '=', $id)->increment('views'); return \Response::make($external_content, 200)->header('Content-type', 'text/html'); } $page = $this->showPage->getPage($id, app('veer')->siteId); if (!is_object($page)) { return Redirect::route('page.index'); } $page->increment('views'); $page->load(array('images' => function ($q) { return $q->orderBy('pivot_id', 'asc'); }, 'tags', 'attributes', 'downloads', 'userlists', 'user')); $page->imagesIds = collect($page->images->getDictionary()); if ($page->show_comments == 1) { $this->showPage->loadComments($page, 'page'); } $paginator_and_sorting = get_paginator_and_sorting(); $data = array("page" => $page, "subpages" => $this->showPage->withChildPages(app('veer')->siteId, $page->id, $paginator_and_sorting), "parentpages" => $this->showPage->withParentPages(app('veer')->siteId, $page->id, $paginator_and_sorting), "products" => $this->showPage->withProducts(app('veer')->siteId, $page->id, $paginator_and_sorting), "categories" => $this->showPage->withCategories(app('veer')->siteId, $page->id), "template" => $this->template); $blade_path = $this->template . '.pages.' . $id; $viewLink = $this->template . '.page'; // page with special design if ($page->original == 1 && \View::exists($blade_path)) { $viewLink = $blade_path; } $view = viewx($viewLink, $data); $this->view = $view; return $view; }
public static function returnShortCodes() { $tpl = static::returnTpl(); shortcode::add("gallery", function ($params = null) use($tpl) { $default = array('tpl' => "gallery-default"); $params = array_merge($default, (array) $params); if (empty($params['tpl']) || !View::exists($tpl . $params['tpl'])) { throw new Exception('Template not found: ' . $tpl . $params['tpl']); } if (!isset($params['id'])) { #return false; #return "Error: id of gallery is not defined!"; throw new Exception('ID of gallery is not defined'); } $gallery_id = $params['id']; $gallery = Gallery::where('id', $gallery_id)->first(); if (!is_object($gallery) || !@$gallery->id) { return false; #return "Error: gallery #{$gallery_id} doesn't exist!"; } $photos = $gallery->photos; if (!$photos->count()) { return false; } #dd($tpl.$params['tpl']); #dd(compact($photos)); #return View::make($tpl.$params['tpl'], compact($photos)); ## don't work return View::make($tpl . $params['tpl'], array('photos' => $photos)); }); }
public function getTemplates($slug) { $view_slug = 'rtclientmanager::angular-templates.' . $slug; if (\View::exists($view_slug)) { return view($view_slug); } abort(404); }
public function view($view) { $currentView = 'admin-lte::default.' . $view; if (\View::exists($currentView)) { return $currentView; } abort(404); }
/** * Display a listing of emailtemplates * * @return Response */ public function showTemplate($template) { // return $template; if (View::exists('emails.templates.' . $template)) { return View::make('emails.templates.' . $template); } return "Template does not exist"; }
function __call($name, $arguments) { $view = new View('page/' . strtolower($name)); if (!$view->exists()) { $view = new View('error/404'); } $this->view->content = $view; }
public function getPage($page) { if (View::exists('documentation.' . $page)) { View::share('page', $page); $this->layout->content = View::make('documentation.' . $page); } else { return App::abort(404); } }
public function showPage($page) { $data['page'] = ucfirst($page); if (View::exists('pages/' . $page)) { return View::make('pages/' . $page, $data); } else { return App::abort(404); } }
/** * Load a theme view from themes/{theme name} * Folder /themes instead /views loaded on boot from SiteServiceProvider * * @return string */ public function view($name, array $data = array()) { $view_name = 'site::' . THEME . '.' . $name; // Set to 'default' view if view not found if (!\View::exists($view_name)) { $view_name_arr = explode('.', $view_name); $view_name = str_replace(end($view_name_arr), 'default', $view_name); } return \View::make($view_name, $data); }
private function makeRowPath($view = null) { if (!$view) { $view = 'default'; } $path = $this->makeViewPath('rows', $view); if (!\View::exists($path)) { throw new \Mrself\YaF\Exceptions\FormException(['name' => $view], 2); } return $path; }
public function index($slug) { $object = $this->object->join('post_translations as t', 't.post_id', '=', 'posts.id')->select('id', 'slug', 'title', 'content', 'meta_desc')->active()->whereSlug($slug)->first(); if (!$object) { App::abort(404); } $meta = ['title' => $object->title, 'desc' => $object->meta_desc]; if (\View::exists('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)) { return view('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)->with(compact('object'))->with(compact('meta')); } return view('berrier::themes.' . config('berrier.theme.name') . '.post')->with(compact('object'))->with(compact('meta')); }
public function index($slug) { $post = $this->post->select('id', 'slug', 'title', 'content', 'meta_desc', 'media', 'categories')->active()->whereSlug($slug)->first(); if (!$post) { App::abort(404); } $meta = ['title' => $post->title, 'desc' => $post->meta_desc]; if (\View::exists('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)) { return view('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)->with(compact('page'))->with(compact('meta')); } return view('berrier::themes.' . config('berrier.theme.name') . '.post')->with(compact('post'))->with(compact('meta')); }
/** * Gets the given view file. * * @param string $view * @return string|null */ public function getView($view) { $activeTheme = $this->getActive(); $parent = $this->getProperty($activeTheme . '::parent'); $views = ['theme' => $this->getThemeNamespace($view), 'parent' => $this->getThemeNamespace($view, $parent), 'module' => $this->getModuleView($view), 'base' => $view]; foreach ($views as $view) { if ($this->viewFactory->exists($view)) { return $view; } } return false; }
public function postSendMessage() { if (!Request::ajax()) { App::abort(404); } $json_request = ['status' => FALSE, 'responseText' => '']; $data = Input::all(); $tpl = 'emails.feedback'; if (View::exists($tpl)) { Mail::send($tpl, $data, function ($message) use($data) { #$message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); $from_email = Config::get('app.settings.main.feedback_from_email') ?: '*****@*****.**'; $from_name = Config::get('app.settings.main.feedback_from_name') ?: 'No-reply'; $message->from($from_email, $from_name); $message->subject('Сообщение обратной связи'); $email = Config::get('app.settings.main.feedback_address') ?: '*****@*****.**'; $emails = array(); if (strpos($email, ',')) { $emails = explode(',', $email); foreach ($emails as $e => $email) { $email = trim($email); if (filter_var($email, FILTER_VALIDATE_EMAIL)) { $emails[$e] = $email; } } $email = array_shift($emails); } $message->to($email); #$ccs = Config::get('mail.feedback.cc'); $ccs = $emails; if (isset($ccs) && is_array($ccs) && count($ccs)) { foreach ($ccs as $cc) { $message->cc($cc); } } /** * Прикрепляем файл */ /* if (Input::hasFile('file') && ($file = Input::file('file')) !== NULL) { #Helper::dd($file->getPathname() . ' / ' . $file->getClientOriginalName() . ' / ' . $file->getClientMimeType()); $message->attach($file->getPathname(), array('as' => $file->getClientOriginalName(), 'mime' => $file->getClientMimeType())); } #*/ }); $json_request['status'] = TRUE; } else { $json_request['responseText'] = 'Template ' . $tpl . ' not found.'; } #Helper::dd($result); return Response::json($json_request, 200); }
/** * Show a single requested page. * @param string $pageName The name of the page to show. * @return \View */ public function showPage($pageName = 'index') { if (!$this->page->exists($pageName)) { return \Response::view($this->theme . '.404', array('global' => $this->global), 404); } $page = $this->page->get($pageName); $viewParamaters = array('global' => $this->global, 'page' => $page); if (\View::exists($this->theme . '.' . $pageName)) { return \View::make($this->theme . '.' . $pageName, $viewParamaters); } else { return \View::make($this->theme . '.page', $viewParamaters); } }
/** * @param $value * @param null $classOrView * @param array $bind * * @return string * @throws \Exception */ public function renderValue($value, $classOrView = null, $bind = []) { if (is_null($classOrView)) { $classOrView = $this->getRenderable('property'); } // If the $renderer is a valid class instanciate and run if (class_exists($classOrView)) { return new $classOrView($value, $this->mode, $bind); } elseif (\View::exists($classOrView)) { return \View::make($classOrView, array_merge(['value' => $value], $bind))->render(); } else { throw new \Exception('Could not found any class or view named "' . $classOrView . '" for rendering property of object "' . get_class($this->entity) . '"'); } }
/** * This method checks to see if a view exists and if it does loads it along with any * associated data from the database. It then checks to see if a function exists for * the passed in page name (substituting dashes for underscores and runs that) if it exists. * @param string $page The page name * @param string $variable Allows us to pass a second variable to things * @return view Ideally a view of some kind */ public function get_index($page = 'home', $variable = false) { $this->data['page'] = Page::where('slug', '=', $page)->first(); $function = strtolower(Request::method() . '_' . str_replace('-', '_', $page)); if (method_exists($this, $function)) { $this->{$function}($variable); } else { if (View::exists('site.' . $page)) { return View::make('site.' . $page, $this->data); } else { return Response::error('404'); } } }
public function index($slug = '') { $object = $this->object->join('category_translations as t', 't.category_id', '=', 'categories id')->whereSlug($slug)->first(); $meta = ['title' => $object->name, 'desc' => $object->name]; if (!$object) { \App::abort(404); } $posts = Post::whereHas('categories', function ($q) use($object) { $q->whereIn('id', $object->getChildren()->pluck('id')->toArray()); })->active()->orderBy('updated_at', 'DESC')->paginate(12); if (\View::exists('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)) { return view('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)->with(compact('page'))->with(compact('meta')); } return view('berrier::themes.' . config('berrier.theme.name') . '.category')->with(compact('category'))->with(compact('meta'))->with(compact('posts')); }
public function checkPageName($page) { if (array_key_exists($page, $this->exceptions)) { $page = $this->exceptions[$page](); } if (array_key_exists($page, $this->pages) === true && View::exists($page) === true) { return $page; } else { if ($page == '/home') { return 'home'; } else { return 'error'; } } }
/** * @param string $view * * @return \Illuminate\View\View */ public function renderInput($view) { // First check if there isn't a model view. $viewName = 'ignicms::admin.formElements.' . $view; if ($this->model instanceof AdminModel && ($identifier = $this->model->getIdentifier())) { // First check if there is a rewrite on specific field type $field = str_slug($this->field); if (\View::exists('resources.' . $identifier . '.formElements.' . $field)) { $viewName = 'resources.' . $identifier . '.formElements.' . $field; } elseif (\View::exists('resources.' . $identifier . '.formElements.' . $view)) { $viewName = 'resources.' . $identifier . '.formElements.' . $view; } } return view($viewName, ['record' => $this->model, 'fieldName' => $this->field, 'elementName' => $this->elementName, 'options' => $this->options, 'sourceModel' => $this->sourceModel]); }
public function index($slug) { $page = $this->page->join('page_translations as t', 't.page_id', '=', 'pages.id')->select('pages.id', 'slug', 'title', 'content', 'meta_desc')->active()->whereSlug($slug)->first(); if (!$page) { App::abort(404); } $meta = ['title' => $page->title, 'desc' => $page->meta_desc]; $page->content = str_replace('{{url}}', \Request::url(), $page->content); $widgets = Widget::extract_unit($page->content, '{{', '}}'); foreach ($widgets as $bbcode => $widget) { $page->content = str_replace('{{' . $bbcode . '}}', $widget, $page->content); } if (\View::exists('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)) { return view('berrier::themes.' . config('berrier.theme.name') . '.custom.' . $slug)->with(compact('page'))->with(compact('meta')); } return view('berrier::themes.' . config('berrier.theme.name') . '.page')->with(compact('page'))->with(compact('meta')); }
public function __construct($ident) { if (!View::exists('emails.templates.' . $ident . '_body')) { $template = DB::table('email_templates')->where('ident', $ident)->first(); if (!$template) { throw new RuntimeException('Template not found'); } if (!file_exists(app_path() . '/views/emails/templates/')) { mkdir(app_path() . '/views/emails/templates/', 0777, true); } file_put_contents(app_path() . '/views/emails/templates/' . $ident . '_subject.blade.php', $template['subject']); file_put_contents(app_path() . '/views/emails/templates/' . $ident . '_body.blade.php', $template['body']); $this->info['subject'] = $template['subject']; } else { $this->info['subject'] = View::make('emails.templates.' . $ident . '_subject')->render(); } $this->info['ident'] = $ident; }
/** * @return string * @throws \Exception */ public function getViewName() { if (!isset($this->viewName)) { // Default view name $identifier = $this->getModel()->getIdentifier(); $fieldName = str_slug($this->fieldName) . '--field'; $field = camel_case(strtolower(snake_case(class_basename(get_class($this))))); // First check if there is a rewrite on specific field type if (\View::exists('resources.' . $identifier . '.formElements.' . $fieldName)) { $this->viewName = 'resources.' . $identifier . '.formElements.' . $fieldName; } elseif (\View::exists('resources.' . $identifier . '.formElements.' . $field)) { $this->viewName = 'resources.' . $identifier . '.formElements.' . $field; } elseif (\View::exists('ignicms::admin.formElements.' . $field)) { $this->viewName = 'ignicms::admin.formElements.' . $field; } else { throw new FieldViewNotFoundException('View not found for field ' . $this->fieldName); } } return $this->viewName; }
/** * Display a listing of settings * * @return Response */ public function index($module = 'general') { // $settings = new CreateSettingsTable; // $settings->down(); // $settings->up(); $settings = Config::get('settings'); $user_settings = Confide::user()->settings; // Check if view exists if (!View::exists('settings.' . $module)) { $alert[] = ['class' => 'alert-warning', 'message' => '<strong><i class="fa fa-warning"></i></strong> Módulo de configurações não encontrado!']; Session::flash('alerts', $alert); if (Request::header('referer')) { return Redirect::back(); } else { $module = 'general'; } } // echo "<pre>"; print_r( Config::get('settings') ); echo "</pre>"; exit; // echo "<pre>"; print_r( $requested_page ); echo "</pre>"; exit; return View::make('settings.index', compact('settings', 'module')); }
public static function prefer($files, $prefix = '') { // Looping backwards through an array if (is_array($files)) { // array_reverse is a lot slower, we'll just break // the foreach foreach ($files as $testFile) { if (View::exists(self::$prefix . $prefix . $testFile)) { $file = $prefix . $testFile; break; } } // Didn't get a match? Well we'll try the fallback // Hopefully that handles it if (!$file) { $file = $prefix . end($files); } } else { $file = $prefix . $files; } return self::$prefix . $file; }
public static function execute($uri) { switch ($uri) { case '/': return ContentActions::executeHome(); case '/fund': return CreditActions::executeFund(); case '/get': return ContentActions::executeGet(); case '/postcommit': return OpsActions::executePostCommit(); case '/list-subscribe': return MailActions::executeListSubscribe(); default: $noSlashUri = ltrim($uri, '/'); if (View::exists('page/' . $noSlashUri)) { return ['page/' . $noSlashUri, []]; } else { return ['page/404', []]; } } }
/** * @return \Illuminate\View\View */ public function show($id) { $data_view = ""; $audit = $this->audit->find($id); Audit::log(Auth::user()->id, trans('admin/audit/general.audit-log.category'), trans('admin/audit/general.audit-log.msg-show')); $data_parser = $audit->data_parser; $isCallable = is_callable($data_parser, true, $callable_name); if ($isCallable) { $dataArray = call_user_func($data_parser, $id); $data_view_name = $dataArray['show_partial']; if ($data_view_name && \View::exists($data_view_name)) { $data_view = \View::make($data_view_name, compact('dataArray')); } } else { $dataArray = json_decode($audit->data, true); $data_view_name = "admin/audit/_audit_log_data_viewer_default"; $data_view = \View::make($data_view_name, compact('dataArray')); } $page_title = trans('admin/audit/general.page.show.title'); $page_description = trans('admin/audit/general.page.show.description', ['name' => $audit->name]); // "Displaying audit log entry"; return view('admin.audit.show', compact('audit', 'data_view', 'page_title', 'page_description')); }