function getLangSwitch() { $local = App::getLocale(); $host = Config::get('app.host'); $fr = '/fr'; $de = '/de'; $en = '/en'; if ($host == 'convergedmaturity.com' || $host == 'convergedmaturity.co.uk' || $host == 'certus.convergedmaturity.co.uk' || $host == 'dellconverged.app' || $host == 'itf.convergedmaturity.com' || $host == 'infoniqa.convergedmaturity.com') { $en = ''; } elseif ($host == 'convergedmaturity.fr') { $fr = ''; } elseif ($host == 'bereit-fuer-konvergente-infrastruktur.de' || $host == 'niteflite.bereit-fuer-konvergente-infrastruktur.de') { $de = ''; } switch ($local) { case 'en': return "\n\t\t\t<li><a href=" . Request::root() . $fr . "><i class=\"flag fr\"></i> French</a></li>\n\t\t\t<li><a href=" . Request::root() . $de . "><i class=\"flag de\"></i> German</a></li>\n\t\t\t"; break; case 'fr': return "\n\t\t\t<li><a href=" . Request::root() . $en . "><i class=\"flag\"></i> English</a></li>\n\t\t\t<li><a href=" . Request::root() . $de . "><i class=\"flag de\"></i> German</a></li>\n\t\t\t"; break; case 'de': return "\n\t\t\t<li><a href=" . Request::root() . $en . "><i class=\"flag\"></i> English</a></li>\n\t\t\t<li><a href=" . Request::root() . $fr . "><i class=\"flag fr\"></i> French</a></li>\n\t\t\t"; break; } }
/** * Initializes the Google Drive connection * * @param array $params Any connection params needed * @return object **/ public static function init($params = []) { // Get the params $pparams = Plugin::params('filesystem', 'googledrive'); $app_id = isset($params['app_id']) && $params['app_id'] != '' ? $params['app_id'] : $pparams->get('app_id'); $app_secret = isset($params['app_secret']) && $params['app_secret'] != '' ? $params['app_secret'] : $pparams->get('app_secret'); $client = new \Google_Client(); $client->setClientId($app_id); $client->setClientSecret($app_secret); $client->addScope(Google_Service_Drive::DRIVE); $client->setAccessType('offline'); $client->setApprovalPrompt('force'); $client->setIncludeGrantedScopes(true); if (isset($params['app_token'])) { $accessToken = $params['app_token']; // json encode turned our array into an object, we need to undo that $accessToken = (array) $accessToken; } else { \Session::set('googledrive.app_id', $app_id); \Session::set('googledrive.app_secret', $app_secret); \Session::set('googledrive.connection_to_set_up', Request::getVar('connection', 0)); // Set upp a return and redirect to Google for auth $return = Request::getVar('return') ? Request::getVar('return') : Request::current(true); $return = base64_encode($return); $redirectUri = trim(Request::root(), '/') . '/developer/callback/googledriveAuthorize'; $client->setRedirectUri($redirectUri); Session::set('googledrive.state', $return); App::redirect($client->createAuthUrl()); } $client->setAccessToken($accessToken); $service = new \Google_Service_Drive($client); $adapter = new \Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter($service, 'root'); return $adapter; }
/** * Method to get the field input markup for a generic list. * Use the multiple attribute to enable multiselect. * * @return string The field input markup. */ protected function getInput() { // Initialize variables. $attributes = array('type' => 'text', 'value' => htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'), 'name' => $this->name, 'id' => $this->id, 'size' => $this->element['size'] ? (int) $this->element['size'] : '', 'maxlength' => $this->element['maxlength'] ? (int) $this->element['maxlength'] : '', 'class' => 'orcid' . ($this->element['class'] ? (string) $this->element['class'] : ''), 'autocomplete' => (string) $this->element['autocomplete'] == 'off' ? 'off' : '', 'readonly' => (string) $this->element['readonly'] == 'true' ? 'readonly' : '', 'disabled' => (string) $this->element['disabled'] == 'true' ? 'disabled' : '', 'onchange' => $this->element['onchange'] ? (string) $this->element['onchange'] : ''); $attr = array(); foreach ($attributes as $key => $value) { if ($key != 'value' && !$value) { continue; } $attr[] = $key . '="' . $value . '"'; } $attr = implode(' ', $attr); $html = array(); $html[] = '<div class="grid">'; $html[] = ' <div class="col span9">'; $html[] = ' <input ' . $attr . ' placeholder="####-####-####-####" />'; $html[] = ' <input type="hidden" name="base_uri" id="base_uri" value="' . rtrim(Request::base(true), '/') . '" />'; $html[] = ' </div>'; $html[] = ' <div class="col span3 omega">'; $html[] = ' <a class="btn button icon-search orcid-fetch" data-base="' . rtrim(Request::base(true), '/') . '" data-id="' . $this->id . '" href="' . Request::base() . '/' . Route::url('index.php?option=com_members&controller=orcid') . '">' . Lang::txt('COM_MEMBERS_PROFILE_ORCID_FIND') . '</a>'; $html[] = ' </div>'; $html[] = '</div>'; $html[] = '<p><img src="' . Request::root() . '/core/components/com_members/site/assets/img/orcid-logo.png" width="80" alt="ORCID" /> ' . Lang::txt('COM_MEMBERS_PROFILE_ORCID_ABOUT') . '</p>'; Behavior::framework(true); Behavior::modal(); if (file_exists(PATH_ROOT . '/core/components/com_members/site/assets/js/orcid.js')) { Document::addScript('/core/components/com_members/site/assets/js/orcid.js?t=' . filemtime(PATH_ROOT . '/core/components/com_members/site/assets/js/orcid.js')); } return implode($html); }
/** * Shorten a new URL * * @return Response */ public function postShorten() { if (!\Auth::check()) { return \Response::json(array('error' => array('code' => 'NOT-AUTH', 'http_code' => '403', 'message' => 'Forbidden')), 403); } $shortenValidator = \Validator::make(\Input::all(), array('url' => 'required|url')); if ($shortenValidator->fails()) { return \Response::json(array('error' => array('code' => 'SHORTEN-VALIDATOR-FAILED', 'http_code' => '400', 'message' => 'Bad Request', 'data' => array('validator_messages' => $shortenValidator->messages()))), 400); } $bigURL = \Input::get('url'); // User has gone over quota so cant shorten if (\Auth::user()->quota_max != 0 && \Auth::user()->quota_used + 1 > \Auth::user()->quota_max) { return \Response::json(array('error' => array('code' => 'QUOTA-USED', 'http_code' => '400', 'message' => 'Bad Request')), 403); } $dbLink = \Link::where('destination', '=', $bigURL)->first(); if (!isset($dbLink)) { $dbLink = new \Link(); $dbLink->user_id = \Auth::user()->id; $dbLink->code = $dbLink->generateCode(); $dbLink->destination = $bigURL; $dbLink->clicks = "0"; $dbLink->save(); \Auth::user()->quota_used += 1; \Auth::user()->save(); } $linkCode = $dbLink->code; $linkURL = \Request::root() . '/' . $linkCode; return \Response::json(array('ok' => array('code' => 'LINK-SHORTENED', 'http_code' => '200', 'message' => 'OK', 'data' => array('url' => $linkURL, 'url_code' => $linkCode))), 200); }
public function __construct(Order $order) { if (!$order) { dd('vantar pöntun'); } $this->order = $order; $this->testing = false; if (env('BORGUN_TEST') == true) { $this->site = 'https://test.borgun.is/SecurePay/default.aspx'; $this->testing = true; $this->PaymentGatewayId = '16'; $this->MerchantId = '9275444'; $this->SecretKey = '99887766'; } else { $this->site = 'https://securepay.borgun.is/securepay/default.aspx'; $this->PaymentGatewayId = env('BORGUN_PAYMENTGATEWAYID'); $this->MerchantId = env('BORGUN_MERCHANTID'); $this->SecretKey = env('BORGUN_SECRETKEY'); } $this->ReturnUrlSuccess = \Request::root() . '/payment/borgun/success'; $this->ReturnUrlSuccessServer = \Request::root() . '/payment/borgun/successserver'; $this->ReturnUrlCancel = \Request::root() . '/payment/borgun/cancel'; $this->ReturnUrlError = ''; $this->OrderId = $order->reference; $this->Amount = $order->total(); $this->Currency = 'ISK'; $this->Language = 'IS'; }
/** * Hook for after routing application * * @return void */ public function onAfterRoute() { if (!App::isAdmin() && !App::isSite()) { return; } $client = 'Site'; if (App::isAdmin()) { $client = 'Admin'; return; } // Check if active for this client (Site|Admin) if (!$this->params->get('activate' . $client) || Request::getVar('format') == 'pdf') { return; } Html::behavior('framework'); if ($this->params->get('jqueryui')) { Html::behavior('framework', true); } if ($this->params->get('jqueryfb')) { Html::behavior('modal'); } if ($this->params->get('noconflict' . $client)) { Document::addScript(Request::root(true) . '/core/assets/js/jquery.noconflict.js'); } }
public function getUrlAttribute() { $defaultLocale = config('gtcmslang.defaultLocale'); $propertyName = config('gtcms.premium') && config('gtcmslang.siteIsMultilingual') ? "slug_" . \App::getLocale() : "slug"; $langPrefix = \App::getLocale() == $defaultLocale ? '' : "/" . \App::getLocale(); return \Request::root() . $langPrefix . "/" . $this->{$propertyName}; }
/** * Initializes the dropbox connection * * @param array $params Any connection params needed * @return \League\Flysystem\Dropbox\DropboxAdapter **/ public static function init($params = []) { // Get the params $pparams = Plugin::params('filesystem', 'dropbox'); if (isset($params['app_token'])) { $accessToken = $params['app_token']; } else { $info = ['key' => isset($params['app_key']) ? $params['app_key'] : $pparams->get('app_key'), 'secret' => isset($params['app_secret']) ? $params['app_secret'] : $pparams->get('app_secret')]; \Session::set('dropbox.app_key', $info['key']); \Session::set('dropbox.app_secret', $info['secret']); \Session::set('dropbox.connection_to_set_up', Request::getVar('connection', 0)); $appInfo = \Dropbox\AppInfo::loadFromJson($info); $clientIdentifier = 'hubzero-cms/2.0'; $redirectUri = trim(Request::root(), '/') . '/developer/callback/dropboxAuthorize'; $csrfTokenStore = new \Dropbox\ArrayEntryStore($_SESSION, 'dropbox-auth-csrf-token'); $oauth = new \Dropbox\WebAuth($appInfo, $clientIdentifier, $redirectUri, $csrfTokenStore); // Redirect to dropbox // We hide the return url in the state field...that's not exactly what // it was intended for, but it does the trick $return = Request::getVar('return') ? Request::getVar('return') : Request::current(true); $return = base64_encode($return); App::redirect($oauth->start($return)); } $app_secret = isset($params['app_secret']) ? $params['app_secret'] : $pparams->get('app_secret'); // Create the client $client = new \Dropbox\Client($accessToken, $app_secret); // Return the adapter return new \League\Flysystem\Dropbox\DropboxAdapter($client, isset($params['subdir']) ? $params['subdir'] : null); }
public static function setBestLanguage($lang) { $root = Request::root(); $ruroot = $root . '/ru'; $enroot = $root . '/en'; $deroot = $root . '/de'; $url = URL::previous(); // Session::put('seg', $url); $request = parse_url($url, PHP_URL_PATH); $parse_array = explode("/", $request); // превращаю в массив if (in_array('login', $parse_array) or in_array('sign-up', $parse_array) or in_array('map', $parse_array)) { if (in_array('ru', $parse_array) or in_array('en', $parse_array) or in_array('de', $parse_array)) { $request = ltrim($request, '/ruden'); $myurl = $root . '/' . $lang . '/' . $request; } else { $myurl = $root . '/' . $lang . $request; } } elseif ($url == $ruroot or $url == $enroot or $url == $deroot or $url == "{$root}/") { $myurl = $root . '/' . $lang; } else { $myurl = $url; //Session::put('seg', $url); } return $myurl; }
/** * Shorten a new URL * * @return Response */ public function postShorten() { // No big url if (!\Input::has('bigurl')) { return \Response::json(array('error' => array('code' => 'MISSING-PARAMETERS', 'http_code' => '400', 'message' => 'Bad Request')), 400); } $bigURL = \Input::get('bigurl'); $user = $this->apiKey->user; // No user linked to API key - SHOULD NEVER HAPPEN if (!isset($user)) { return \Response::json(array('error' => array('code' => 'NOT-AUTH', 'http_code' => '403', 'message' => 'Forbidden: SHOULD NEVER HAPPEN!')), 403); } // User has gone over quota so cant shorten if ($user->quota_max != 0 && $user->quota_used + 1 > $user->quota_max) { return \Response::json(array('error' => array('code' => 'QUOTA-USED', 'http_code' => '400', 'message' => 'Bad Request')), 403); } if (filter_var($bigURL, FILTER_VALIDATE_URL) === false) { return \Response::json(array('error' => array('code' => 'URL-INVALID', 'http_code' => '400', 'message' => 'Bad Request')), 400); } $dbLink = \Link::where('destination', '=', $bigURL)->first(); if (!isset($dbLink)) { $dbLink = new \Link(); $dbLink->user_id = $user->id; $dbLink->code = $dbLink->generateCode(); $dbLink->destination = $bigURL; $dbLink->clicks = "0"; $dbLink->save(); $user->quota_used += 1; $user->save(); } $linkCode = $dbLink->code; $linkURL = \Request::root() . '/' . $linkCode; return \Response::json(array('ok' => array('code' => 'LINK-SHORTENED', 'http_code' => '200', 'message' => 'OK', 'data' => array('url' => $linkURL, 'url_code' => $linkCode))), 200); }
public function logoutAction() { // Log out if (Auth::User()) { $user = new Usernhc(); $user_id = Auth::User()->id; $user_info = $user->getUsernhcById($user_id); $logs = new Logs(); $logs->ip = Request::getClientIp(); $logs->host = Request::root(); $logs->lastpage = ''; $logs->last_visit = date('Y-m-d H:i:s'); $logs->role_id = $user_info[0]->role_id; $logs->data_id = rand(1, 11); $logs->userid = $user_id; $logs->save(); } // Redirect to homepage if (Auth::logout()) { Auth::logout(); return Redirect::to('login')->with('success', 'ออกจากระบบสำเร็จ'); } else { return Redirect::to('login')->with('success', 'ออกจากระบบสำเร็จ'); } }
/** * Create a new Manager object. * * @param array $config * @param \Illuminate\Session\Store $session */ public function __construct($config, SessionStore $session) { $this->api = new SeeClickFix(array('client_id' => $config["laravel-seeclickfix-api::client_id"], 'client_secret' => $config["laravel-seeclickfix-api::client_secret"], 'redirect_uri' => \Request::root() . $config["laravel-seeclickfix-api::redirect_uri"], 'sandbox' => $config["laravel-seeclickfix-api::sandbox_mode"])); $this->session = $session; $this->config = $config; // Get token from the session, if any $this->check(); }
public function getLink() { $domain = \Config::get('shortener-domain', \Request::root()); $domain = !$domain ? \Request::root() : $domain; $prefix = \Config::get('shortener-prefix', '+'); $prefix = empty($prefix) ? '+' : $prefix; return str_replace(['https://', 'http://'], '', $domain . '/' . $prefix . $this->hash); }
public function checkActiveMenu() { $pathUrl = str_replace(Request::root() . "/", "", $this->getUrl()); if (Request::is($pathUrl) || Request::is($pathUrl . "/*")) { return true; } else { return false; } }
public function __construct() { $docs = Doc::orderBy('updated_at', 'desc')->take(10)->get(); View::share('docs', $docs); $socials = array('og_image' => Config::get('socials.og_image'), 'og_title' => Config::get('socials.og_title'), 'og_description' => Config::get('socials.og_description'), 'og_url' => Request::url(), 'og_site_name' => Request::root()); View::share('socials', $socials); $params = array('hosts' => array('localhost:9200')); $this->es = new Elasticsearch\Client($params); }
function loadStatic($file) { $realFile = public_path() . $file; if (!file_exists($realFile)) { return ''; } $filemtime = filemtime($realFile); return Request::root() . $file . '?v=' . $filemtime; }
/** * Display an image. * * @param string $src The source of the image * * @return string A <img> element if the specified file exists, otherwise, a null string * * @since 2.5 */ public static function image($src) { $src = preg_replace('#[^A-Z0-9\\-_\\./]#i', '', $src); $file = JPATH_SITE . '/' . $src; \Hubzero\Filesystem\Util::checkPath($file); if (!file_exists($file)) { return ''; } return '<img src="' . Request::root() . $src . '" alt="" />'; }
/** * Return data on a resource view (this will be some form of HTML) * * @param object $publication Current publication * @param string $option Name of the component * @param array $areas Active area(s) * @param string $rtrn Data to be returned * @param string $version Version name * @param boolean $extended Whether or not to show panel * @return array */ public function onPublication($publication, $option, $areas, $rtrn = 'all', $version = 'default', $extended = true) { $view = $this->view(); Document::addCustomTag('<meta property="og:title" content="' . $view->escape($publication->title) . '" />'); Document::addCustomTag('<meta property="og:description" content="' . $view->escape($publication->abstract) . '" />'); Document::addCustomTag('<meta property="og:type" content="article" />'); $url = Route::url($publication->link()); $url = rtrim(Request::root(), '/') . '/' . trim($url, '/'); Document::addCustomTag('<meta property="og:url" content="' . $url . '" />'); }
public function run() { $siteTitle = Site\Admin\Models\Settings::where('setting', '=', 'site_title')->get()->first(); if (is_null($siteTitle)) { Site\Admin\Models\Settings::create(array('setting' => 'site_title', 'value' => 'Comparison Site')); } $rootUrl = Site\Admin\Models\Settings::where('setting', '=', 'root_url')->get()->first(); if (is_null($rootUrl)) { Site\Admin\Models\Settings::create(array('setting' => 'root_url', 'value' => Request::root())); } }
public static function rss($news) { $string = "<rss version='2.0'>"; $string .= "<channel>"; $string .= "<title>Puškice</title>\n\t\t\t\t\t<link>" . Request::root() . "</link>\n\t\t\t\t\t<description>Tačka spajanja studenata FON-a</description>\n\t\t\t\t\t<language>sr-rs</language>\n\t\t\t\t\t<pubDate>" . date("D, d M Y H:i:s e", strtotime("now")) . "</pubDate>\n\t\t\t\t\t<lastBuildDate>" . date("D, d M Y H:i:s e", strtotime("now")) . "</lastBuildDate>\n\t\t\t\t\t<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n\t\t\t\t\t<generator>Puškice generator</generator>\n\t\t\t\t\t<managingEditor>info@puskice.org</managingEditor>\n\t\t\t\t\t<webMaster>info@puskice.org</webMaster>"; foreach ($news as $article) { $string .= "<item>\n\t\t\t\t\t\t\t<title>" . $article->title . "</title>\n\t\t\t\t\t\t\t<link>" . Request::root() . "/vest/" . Puskice::dateToUrl($article->created_at) . "/" . $article->permalink . "</link>\n\t\t\t\t\t\t\t<description><![CDATA[" . Trans::_t($article->short_content) . "]]></description>\n\t\t\t\t\t\t\t<pubDate>" . date("D, d M Y H:i:s e", strtotime($article->created_at)) . "</pubDate>\n\t\t\t\t\t\t\t<guid>" . Request::root() . "/vest/" . Puskice::dateToUrl($article->created_at) . "/" . $article->permalink . "</guid>\n\t\t\t\t\t\t</item>"; } $string .= "</channel>"; $string .= "</rss>"; return $string; }
public function currentReferrer() { $referrer_url = app('request')->headers->get('referer'); if (empty($referrer_url) || $referrer_url == Request::root()) { return; } $referrer = Referrer::where('url', '=', $referrer_url)->where('short_url_id', '=', $this->id)->first(); if (!$referrer) { $referrer = new Referrer(['url' => $referrer_url, 'short_url_id' => $this->id]); } return $referrer; }
public function postEditMessage($item, $user) { $params = []; $params['fallback'] = "記事が編集されました。( " . \Request::root() . '/items/' . $item->open_item_id . " )"; $params['pretext'] = \Request::root() . '/items/' . $item->open_item_id; $params['author_name'] = $user->username; $params['author_link'] = \Request::root() . '/' . $user->username; $params['author_icon'] = \HTML::gravator($user->email, 16, 'mm', 'g', false); $params['title'] = $item->title; $params['title_link'] = \Request::root() . '/items/' . $item->open_item_id; $params['text'] = mb_strimwidth($item->body, 0, 200, "..."); return $this->postMessage($params); }
/** * This will publish the story to the database */ public function publishStory() { $oRequestInstance = \Request::instance(); $oRouteInstance = \Route::current(); // get the extra custom data supplied by the user $aCustomData = $this->getCustomSuppliedData(); $uri = head($oRouteInstance->methods()) . ' ' . $oRouteInstance->uri(); $aData = ['ip_address' => \Input::getClientIp(), 'domain' => \Request::root(), 'path' => \Request::path(), 'request_method' => $oRequestInstance->getMethod(), 'query_string' => $oRequestInstance->getQueryString(), 'post_string' => \Request::method() == "POST" ? json_encode(\Input::all()) : NULL, 'is_ajax' => \Request::ajax(), 'is_secure' => \Request::secure(), 'route_uri' => $uri ?: '-', 'route_name' => $oRouteInstance->getName() ?: '-', 'route_action' => $oRouteInstance->getActionName() ?: '-', 'class_method' => \Request::method()]; // merge the custom data to the already built data $aData = array_merge($aData, $aCustomData); // save the collected data $this->getSessionManager()->saveCollectedData($aData); }
public function __construct(Request $request) { $httpCookie = $request->server('HTTP_COOKIE'); $cookieArray = array(); if ($httpCookie) { $cookies = explode(";", $httpCookie); foreach ($cookies as $cookie) { $cookieObject = explode("=", trim($cookie)); $cookieArray[$cookieObject[0]] = $cookieObject[1]; } } $route = explode('/', Route::current()->uri()); $this->vars = array_merge($cookieArray, ['api' => \Request::root(), 'route' => isset($route[1]) ? $route[1] : null, 'type' => isset($route[2]) ? $route[2] : null, 'value' => isset($route[2]) ? $this->getLibrary($route[2]) : null]); }
/** * Return data on a resource view (this will be some form of HTML) * * @param object $resource Current resource * @param string $option Name of the component * @param array $areas Active area(s) * @param string $rtrn Data to be returned * @return void */ public function onResources($model, $option, $areas, $rtrn = 'all') { if (!App::isSite()) { return; } if (Request::getWord('tmpl') || Request::getWord('format') || Request::getInt('no_html')) { return; } $view = $this->view(); Document::addCustomTag('<meta property="og:title" content="' . $view->escape($model->resource->title) . '" />'); Document::addCustomTag('<meta property="og:description" content="' . $view->escape($model->resource->introtext) . '" />'); Document::addCustomTag('<meta property="og:type" content="article" />'); $url = Route::url('index.php?option=com_resources&' . ($model->resource->alias ? 'alias=' . $model->resource->alias : 'id=' . $model->resource->id)); $url = rtrim(Request::root(), '/') . '/' . trim($url, '/'); Document::addCustomTag('<meta property="og:url" content="' . $url . '" />'); }
/** * Set DOI service configs * * @param mixed $idx Index value * @return array */ public function configs() { if (empty($this->_configs)) { $params = Component::params('com_publications'); $configs = new stdClass(); $configs->shoulder = $params->get('doi_shoulder'); $configs->service = trim($params->get('doi_service'), DS); $configs->prefix = $params->get('doi_prefix'); $configs->userpw = $params->get('doi_userpw'); $configs->publisher = $params->get('doi_publisher', Config::get('sitename')); $configs->livesite = trim(Request::root(), DS); $configs->xmlSchema = trim($params->get('doi_xmlschema', 'http://schema.datacite.org/meta/kernel-2.1/metadata.xsd'), DS); $this->_configs = $configs; } return $this->_configs; }
/** * Display the thumb for the template. * * @param string $template The name of the active view. * @param integer $protected * @return string */ public static function thumb($template, $protected = 0) { $basePath = ($protected == 0 ? PATH_APP : PATH_CORE) . '/templates/' . $template; $baseUrl = Request::root(true) . ($protected == 0 ? '/app' : '/core'); $thumb = $basePath . '/template_thumbnail.png'; $preview = $basePath . '/template_preview.png'; $html = ''; if (file_exists($thumb)) { $html = Html::asset('image', ltrim(substr($thumb, strlen(PATH_ROOT)), DS), Lang::txt('COM_TEMPLATES_PREVIEW')); if (file_exists($preview)) { $preview = $baseUrl . '/templates/' . $template . '/template_preview.png'; $html = '<a href="' . $preview . '" class="modal" title="' . Lang::txt('COM_TEMPLATES_CLICK_TO_ENLARGE') . '">' . $html . '</a>'; } } return $html; }
/** * Handle request in HTTP stack * * @param object $request HTTP Request * @return mixed */ public function handle(Request $request) { $response = $this->next($request); $document = $this->app['document']; $params = array(); // Set meta tags if ($document->getType() == 'html') { if (!$document->getMetaData('keywords')) { $document->setMetaData('keywords', $this->app['config']->get('MetaKeys')); } $document->setMetaData('rights', $this->app['config']->get('MetaRights')); $file = $request->getCmd('tmpl', 'index'); if (!$this->app['config']->get('offline') && $file == 'offline') { $file = 'index'; } $params = array('template' => $this->app['template']->template, 'file' => $file . '.php', 'directory' => dirname($this->app['template']->path), 'params' => $this->app['template']->params); $params['baseurl'] = rtrim(\Request::root(true), '/') . rtrim(substr(dirname($params['directory']), strlen(PATH_ROOT)), '/'); } if (!$document->getTitle()) { $document->setTitle($this->app['config']->get('sitename')); } if ($this->app->isAdmin()) { $document->setTitle($this->app['config']->get('sitename') . ' - ' . $this->app['language']->txt('JADMINISTRATION')); } if (!$document->getDescription()) { $document->setDescription($this->app['config']->get('MetaDesc')); } if ($this->app['config']->get('MetaVersion', 0)) { $document->setGenerator($document->getGenerator() . ' (' . $this->app->version() . ')'); } $document->setBuffer($response->getContent(), 'component'); $document->parse($params); $caching = false; if ($this->app['config']->get('caching', 2) == 2 && !\User::get('id')) { $caching = true; } $this->app['dispatcher']->trigger('system.onBeforeRender'); $response->setContent($document->render($caching, $params)); $this->app['dispatcher']->trigger('system.onAfterRender'); if ($profiler = $this->app['profiler']) { $profiler->mark('onAfterRender'); } return $response; }
/** * Display the thumb for the template. * * @param string The name of the active view. */ public static function thumb($template, $clientId = 0) { $client = JApplicationHelper::getClientInfo($clientId); $basePath = $client->path . '/templates/' . $template; $baseUrl = $clientId == 0 ? Request::root(true) : Request::root(true) . '/administrator'; $thumb = $basePath . '/template_thumbnail.png'; $preview = $basePath . '/template_preview.png'; $html = ''; if (file_exists($thumb)) { $clientPath = $clientId == 0 ? '' : 'administrator/'; $thumb = $clientPath . 'templates/' . $template . '/template_thumbnail.png'; $html = Html::asset('image', $thumb, Lang::txt('COM_TEMPLATES_PREVIEW')); if (file_exists($preview)) { $preview = $baseUrl . '/templates/' . $template . '/template_preview.png'; $html = '<a href="' . $preview . '" class="modal" title="' . Lang::txt('COM_TEMPLATES_CLICK_TO_ENLARGE') . '">' . $html . '</a>'; } } return $html; }
public function showProviderChooser() { $has_firstname = Input::get('firstname', false); if ($has_firstname) { Session::put('firstname', Input::get('firstname')); Session::put('lastname', Input::get('lastname')); Session::put('birthdate', Input::get('birthdate')); //need to validate this! Session::put('digitalsig', Input::get('digitalsig')); } else { echo "How did you get here without filling out the form?"; exit; } if (strpos(Request::root(), 'local') !== false) { $api_url = "http://patchlocal.ft1.us/"; } else { $api_url = "http://patch.ft1.us/"; } return View::make('providerchoose', array('api_url' => $api_url)); }