public static function resolve($uri) { // Place trailing slash on base URL $uri = static::remove($uri, rtrim(\Laravel\URL::base(), '/#')); $uri = rtrim($uri, '#'); static::$uri = static::format($uri); static::segments(static::$uri); return static::$uri; }
private function NewQuoteEmail(Customer $customer, Quotation $quote) { $data = array(); $data['customer'] = $customer; $data['quote'] = $quote; $mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = 'truecloudmedia.co.uk'; $mail->SMTPAuth = true; $mail->Username = '******'; $mail->Password = '******'; $mail->SMTPSecure = 'tls'; $mail->Port = 587; $mail->setFrom('*****@*****.**', 'Booth Garden Studios'); $mail->addAddress($customer->email); $mail->isHTML(true); $mail->Subject = 'Booth Garden Studios Quotation #' . $quote->id; $mail->Body = ' <p><img src="' . \Laravel\URL::to('/') . 'img/logo-booths-large.png" alt="Garden Booth Studios" /></p> <p>Thank you for completing a quotation with Garden Booths Studio.</p> <p>Your perfect studio came to £' . number_format($quote->price, 2) . '</p> <p>You can log into your account by <a href="' . action('quotations.sign_in') . '">clicking here</a> and using your email address and post code.</p> <p> <b>Email: </b> ' . $customer->email . '<br /> <b>Post Code: </b> ' . $quote->postcode . ' </p> <p>Or you can access your quote directly by clicking the below link.</p> <p><a href="' . action('quotations.my_quotes_load') . '/' . $quote->id . '?c=' . $quote->quick_access_code . '">' . action('quotations.my_quotes_load') . '/' . $quote->id . '?c=' . $quote->quick_access_code . '</a></p> <p>Garden Booth Studios</p> '; $mail->send(); }
/** * Return path to ckeditor.js. */ private function ckeditorPath() { if (!empty($this->basePath)) { return $this->basePath; } else { return \Laravel\URL::base() . '/bundles/ckeditor/ckeditor/'; } // Not used in Laravel // /** // * The absolute pathname of the currently executing script. // * Note: If a script is executed with the CLI, as a relative path, such as file.php or ../file.php, // * $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user. // */ // if (isset($_SERVER['SCRIPT_FILENAME'])) { // $realPath = dirname($_SERVER['SCRIPT_FILENAME']); // } // else { // /** // * realpath - Returns canonicalized absolute pathname // */ // $realPath = realpath( './' ) ; // } // // /** // * The filename of the currently executing script, relative to the document root. // * For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar // * would be /test.php/foo.bar. // */ // $selfPath = dirname($_SERVER['PHP_SELF']); // $file = str_replace("\\", "/", __FILE__); // // if (!$selfPath || !$realPath || !$file) { // return "/ckeditor/"; // } // // $documentRoot = substr($realPath, 0, strlen($realPath) - strlen($selfPath)); // $fileUrl = substr($file, strlen($documentRoot)); // $ckeditorUrl = str_replace("ckeditor_php5.php", "", $fileUrl); // // return $ckeditorUrl; }
public static function link($url, $title, $attributes = array(), $https = false) { $url = static::entities(URL::to($url, $https)); return '<a href="' . $url . '"' . static::attributes($attributes) . '>' . $title . '</a>'; }
/** * Return the root asset path for the given bundle. * * @param string $bundle * @return string */ public static function assets($bundle) { if (is_null($bundle)) { return static::assets(DEFAULT_BUNDLE); } return $bundle != DEFAULT_BUNDLE ? URL::base() . "/bundles/{$bundle}/" : URL::base() . '/'; }
/** * Return the root asset path for the given bundle. * * @param string $bundle * @return string */ public static function assets($bundle) { return $bundle != DEFAULT_BUNDLE ? URL::base() . "/bundles/{$bundle}/" : URL::base() . '/'; }
/** * Create a redirect response to a named route. * * <code> * // Create a redirect response to the "login" named route * return Redirect::to_route('login'); * * // Create a redirect response to the "profile" named route with parameters * return Redirect::to_route('profile', array($username)); * </code> * * @param string $route * @param array $parameters * @param int $status * @return Redirect */ public static function to_route($route, $parameters = array(), $status = 302) { return static::to(URL::to_route($route, $parameters), $status); }
/** * Create a HTML image input element. * * The URL::to_asset method will be called on the given URL. * * <code> * // Create an image input element * echo Form::image('img/submit.png'); * </code> * * @param string $url * @param array $attributes * @return string */ public static function image($url, $name = null, $attributes = array()) { $attributes['src'] = URL::to_asset($url); return static::input('image', $name, null, $attributes); }
/** * Extended to pass URLs through Laravel. * * @internal * @param array $matches * @return string * @uses Laravel\URL::to() */ function _doAnchors_inline_callback($matches) { $link_text = $this->runSpanGamut($matches[2]); $url = $matches[3] == '' ? $matches[4] : $matches[3]; $title = isset($matches[7]) ? $matches[7] : null; $url = $this->encodeAttribute($url); // BEGIN: Modification to pass URLs through Laravel if ($url[0] !== '#' and is_null(parse_url($url, PHP_URL_SCHEME))) { $url = \Laravel\URL::to($url); } // END $result = "<a href=\"{$url}\""; if (isset($title)) { $title = $this->encodeAttribute($title); $result .= " title=\"{$title}\""; } $link_text = $this->runSpanGamut($link_text); $result .= ">{$link_text}</a>"; return $this->hashPart($result); }
/** * Extended to pass URLs through Laravel. * * @internal * @param array $matches * @return string * @uses Laravel\URL::to_asset() */ function _doImages_inline_callback($matches) { $alt_text = $matches[2]; $url = $matches[3] == '' ? $matches[4] : $matches[3]; $title = isset($matches[7]) ? $matches[7] : null; $alt_text = $this->encodeAttribute($alt_text); $url = $this->encodeAttribute($url); // BEGIN: Modification to pass URLs through Laravel if ($url[0] !== '#' and is_null(parse_url($url, PHP_URL_SCHEME))) { $url = \Laravel\URL::to_asset($url); } // END $result = "<img src=\"{$url}\" alt=\"{$alt_text}\""; if (isset($title)) { $title = $this->encodeAttribute($title); $result .= " title=\"{$title}\""; # $title already quoted } $result .= $this->empty_element_suffix; return $this->hashPart($result); }
public static function url($url) { $url = trim($url, '/'); return URL::to(static::handle() . '/' . $url); }
public static function to_language($language, $reset = false) { $url = $reset ? URL::home() : URL::to(URI::current()); if (!in_array($language, Config::get('application.languages'))) { return $url; } $from = '/' . Config::get('application.language') . '/'; $to = '/' . $language . '/'; return str_replace($from, $to, $url); }
<?php Route::get('(:bundle)/rejigger.js', array('as' => 'rejigger_js', function () { return View::make('rejigger::js'); })); Route::get('(:bundle)/version', array('as' => 'rejigger_version', function () { // Don't let the controller mistake this for a regular AJAX call unset($_SERVER['HTTP_X_REQUESTED_WITH']); $uri = \Rejigger\URI::resolve(Input::get('uri')); $route = \Laravel\Routing\Router::route('GET', $uri); $response = $route->call(); $version = md5($response->content); // Parse out resources (css & script) preg_match_all('/\\<script[^\\>]+src=\\"(?P<src>[^\\"]+)\\"[^\\>]*\\>/i', $response->content, $scripts); preg_match_all('/\\<link[^\\>]+href=\\"(?P<href>[^\\"]+)\\"[^\\>]*\\>/i', $response->content, $styles); preg_match_all('/\\<img[^\\>]+src=\\"(?P<src>[^\\"]+)\\"[^\\>]*\\>/i', $response->content, $images); $resources = array_merge($scripts['src'], $styles['href'], $images['src']); $public = path('public'); foreach ($resources as $resource) { $resource = $public . str_replace(\Laravel\URL::base(), '', $resource); if (\Laravel\File::exists($resource)) { $version .= File::modified($resource); } } return '{ "version": "' . md5($version) . '" }'; }));
/** * Get the URL to switch language, keeping the current page or not * * @param string $language The new language * @param boolean $reset Whether navigation should be reset * @return string An URL */ public static function to_language($language, $reset = false) { // Get the url to use as base $url = $reset ? URL::home() : URL::to(URI::current()); // Validate the language if (!in_array($language, Config::get('application.languages'))) { return $url; } // Get the language we're switching from and the one we're going to $from = '/' . Config::get('application.language') . '/'; $to = '/' . $language . '/'; return str_replace($from, $to, $url); }