本文整理汇总了PHP中Route::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::url方法的具体用法?PHP Route::url怎么用?PHP Route::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getReportedItem
/**
* Retrieves a row from the database
*
* @param string $refid ID of the database table row
* @param string $category Element type (determines table to look in)
* @param string $parent If the element has a parent element
* @return array
*/
public function getReportedItem($refid, $category, $parent)
{
if (!$this->_canHandle($category)) {
return null;
}
$database = App::get('db');
if ($category == 'wish') {
$query = "SELECT ws.id, ws.about as `text`, ws.proposed AS created, ws.proposed_by as `author`, ws.subject as `subject`, 'wish' as parent_category, ws.anonymous as anon\n\t\t\t\t\t\tFROM `#__wishlist_item` AS ws\n\t\t\t\t\t\tWHERE ws.id=" . $database->quote($refid);
} else {
if ($category == 'wishcomment') {
$query = "SELECT rr.id, rr.content as `text`, rr.created, rr.created_by as `author`, NULL as `subject`, rr.category as parent_category, rr.anonymous as anon\n\t\t\t\t\t\tFROM `#__item_comments` AS rr\n\t\t\t\t\t\tWHERE rr.id=" . $database->quote($refid);
}
}
$database->setQuery($query);
$rows = $database->loadObjectList();
if ($rows) {
foreach ($rows as $key => $row) {
if (preg_match('/^<!-- \\{FORMAT:(.*)\\} -->/i', $row->text, $matches)) {
$rows[$key]->text = preg_replace('/^(<!-- \\{FORMAT:.*\\} -->)/i', '', $row->text);
}
$rows[$key]->href = $parent ? Route::url('index.php?option=com_wishlist&task=wishlist&id=' . $parent) : '';
if ($rows[$key]->parent_category == 'wishcomment') {
$rows[$key]->href = Route::url('index.php?option=com_wishlist&task=wish&wishid=' . $parent);
}
}
}
return $rows;
}
示例2: displayTask
/**
* Pub view for project files, notes etc.
*
* @return void
*/
public function displayTask()
{
require_once PATH_CORE . DS . 'components' . DS . 'com_projects' . DS . 'tables' . DS . 'publicstamp.php';
// Incoming
$stamp = Request::getVar('s', '');
// Clean up stamp value (only numbers and letters)
$regex = array('/[^a-zA-Z0-9]/');
$stamp = preg_replace($regex, '', $stamp);
// Load item reference
$objSt = new Tables\Stamp($this->database);
if (!$stamp || !$objSt->loadItem($stamp)) {
App::redirect(Route::url('index.php?option=' . $this->_option));
return;
}
// Can only serve files or notes at the moment
if (!in_array($objSt->type, array('files', 'notes', 'publications'))) {
App::redirect(Route::url('index.php?option=' . $this->_option));
return;
}
// Serve requested item
$content = Event::trigger('projects.serve', array($objSt->type, $objSt->projectid, $objSt->reference));
// Output
foreach ($content as $out) {
if ($out) {
return $out;
}
}
// Redirect if nothing fetched
App::redirect(Route::url('index.php?option=' . $this->_option));
return;
}
示例3: action_update
/**
* Update new forum
*/
public function action_update()
{
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Topic')));
$topic = new Model_Topic($this->request->param('id'));
$get_all = Model_Forum::get_all();
//get all forums to build forum parents in select
$forum_parents = array();
foreach ($get_all[0] as $parent) {
$forum_parents[$parent['id']] = $parent['name'];
}
$this->template->content = View::factory('oc-panel/pages/forum/topic', array('topic' => $topic, 'forum_parents' => $forum_parents));
if ($_POST) {
$topic->title = core::post('title');
$topic->id_forum = core::post('id_forum');
$topic->description = core::post('description');
if (core::post('seotitle') != $topic->seotitle) {
$topic->seotitle = $topic->gen_seotitle(core::post('seotitle'));
}
if (core::post('status') == 'on') {
$topic->status = 1;
} else {
$topic->status = 0;
}
try {
$topic->save();
Alert::set(Alert::SUCCESS, __('Topic is updated.'));
} catch (Exception $e) {
Alert::set(Alert::ERROR, $e->getMessage());
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'topic', 'action' => 'index')));
}
}
示例4: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
$gallery = $this->image->gallery();
echo Form::open(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $this->image->id, 'action' => 'report')), array('class' => Request::current()->is_ajax() ? 'ajaxify' : ''));
?>
<fieldset>
<?php
echo Form::control_group(Form::input('reason', null, array('class' => 'input-block-level')), array('name' => __('Reason')), null, __('You can enter an optional reason for reporting this image, e.g. why it should be removed'));
?>
</fieldset>
<fieldset class="form-actions">
<?php
echo Form::button('save', __('Report'), array('type' => 'submit', 'class' => 'btn btn-danger btn-large'));
?>
<?php
echo Request::current()->is_ajax() ? '' : HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $this->image->id, 'action' => '')), __('Cancel'), array('class' => 'cancel'));
?>
<?php
echo Form::csrf();
?>
</fieldset>
<?php
return ob_get_clean();
}
示例5: get
/**
* Get newsfeed item as HTML
*
* @param Model_NewsfeedItem $item
* @return string
*/
public static function get(Model_NewsfeedItem $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_COMMENT:
$gallery = Model_Gallery::factory($item->data['gallery_id']);
$image = Model_Image::factory($item->data['image_id']);
if ($gallery->loaded() && $image->loaded()) {
$text = __('commented to an image<br />:gallery', array(':gallery' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), '<i class="icon-camera icon-white"></i> ' . HTML::chars($gallery->name), array('class' => 'hoverable'))));
}
break;
case self::TYPE_COMMENT_FLYER:
$flyer = Model_Flyer::factory($item->data['flyer_id']);
if ($flyer->loaded()) {
$text = __('commented to a flyer<br />:flyer', array(':flyer' => HTML::anchor(Route::url('flyer', array('id' => $flyer->id)), '<i class="icon-picture icon-white"></i> ' . ($flyer->name ? HTML::chars($flyer->name) : __('flyer')), array('class' => 'hoverable'))));
}
break;
case self::TYPE_FLYER_EDIT:
$flyer = Model_Flyer::factory($item->data['flyer_id']);
if ($flyer->loaded()) {
$text = __('updated flyer<br />:flyer', array(':flyer' => HTML::anchor(Route::url('flyer', array('id' => $flyer->id)), '<i class="icon-picture icon-white"></i> ' . ($flyer->name ? HTML::chars($flyer->name) : __('flyer')), array('class' => 'hoverable'))));
}
break;
case self::TYPE_NOTE:
$gallery = Model_Gallery::factory($item->data['gallery_id']);
$image = Model_Image::factory($item->data['image_id']);
$user = Model_User::find_user($item->data['user_id']);
if ($gallery->loaded() && $image->loaded() && $user->loaded()) {
$text = __('tagged :user to an image<br />:gallery', array(':user' => HTML::user($user), ':gallery' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), '<i class="icon-tag icon-white"></i> ' . HTML::chars($gallery->name), array('class' => 'hoverable'))));
}
break;
}
return $text;
}
示例6: onUsageDisplay
/**
* Event call for displaying usage data
*
* @param string $option Component name
* @param string $task Component task
* @param object $db JDatabase
* @param array $months Month names (Jan -> Dec)
* @param array $monthsReverse Month names in reverse (Dec -> Jan)
* @param string $enddate Time period
* @return string HTML
*/
public function onUsageDisplay($option, $task, $db, $months, $monthsReverse, $enddate)
{
// Check if our task is the area we want to return results for
if ($task) {
if (!in_array($task, $this->onUsageAreas()) && !in_array($task, array_keys($this->onUsageAreas()))) {
return '';
}
}
// Set some vars
$thisyear = date("Y");
$o = \Components\Usage\Helpers\Helper::options($db, $enddate, $thisyear, $monthsReverse, 'check_for_regiondata');
// Build HTML
$html = '<form method="post" action="' . Route::url('index.php?option=' . $option . '&task=' . $task) . '">' . "\n";
$html .= "\t" . '<fieldset class="filters">' . "\n";
$html .= "\t\t" . '<label>' . "\n";
$html .= "\t\t\t" . Lang::txt('PLG_USAGE_SHOW_DATA_FOR') . ': ' . "\n";
$html .= "\t\t\t" . '<select name="selectedPeriod" id="selectedPeriod">' . "\n";
$html .= $o;
$html .= "\t\t\t" . '</select>' . "\n";
$html .= "\t\t" . '</label> <input type="submit" value="' . Lang::txt('PLG_USAGE_VIEW') . '" />' . "\n";
$html .= "\t" . '</fieldset>' . "\n";
$html .= '</form>' . "\n";
$html .= \Components\Usage\Helpers\Helper::toplist($db, 10, 1, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 17, 2, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 11, 3, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 9, 4, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 12, 5, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 19, 6, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 18, 7, $enddate);
$html .= \Components\Usage\Helpers\Helper::toplist($db, 7, 8, $enddate);
// Return HTML
return $html;
}
示例7: action_pay
/**
* [action_form] generates the form to pay at paypal
*/
public function action_pay()
{
$this->auto_render = FALSE;
$id_order = $this->request->param('id');
//retrieve info for the item in DB
$order = new Model_Order();
$order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
// include class vendor
require Kohana::find_file('vendor/authorize/', 'autoload');
define('AUTHORIZENET_API_LOGIN_ID', Core::config('payment.authorize_login'));
define('AUTHORIZENET_TRANSACTION_KEY', Core::config('payment.authorize_key'));
define('AUTHORIZENET_SANDBOX', Core::config('payment.authorize_sandbox'));
$sale = new AuthorizeNetAIM();
$sale->amount = $order->amount;
$sale->card_num = Core::post('card-number');
$sale->exp_date = Core::post('expiry-month') . '/' . Core::post('expiry-year');
$response = $sale->authorizeAndCapture();
if ($response->approved) {
$order->confirm_payment('authorize', $response->transaction_id);
//redirect him to his ads
Alert::set(Alert::SUCCESS, __('Thanks for your payment!') . ' ' . $response->transaction_id);
$this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders')));
} else {
Alert::set(Alert::INFO, $response->error_message);
$this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
}
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
}
}
示例8: action_index
public function action_index()
{
if ($this->request->method() == HTTP_Request::POST) {
try {
if ($this->request->post('active')) {
$pet = ORM::factory('User_Pet')->where('user_pet.id', '=', $this->request->post('active'))->where('user_id', '=', $this->user->id)->find();
$pet->active = time();
$pet->save();
Hint::success($pet->name . ' is now your active pet.');
}
if ($this->request->post('abandon')) {
$pet = ORM::factory('User_Pet')->where('user_pet.id', '=', $this->request->post('abandon'))->where('user_id', '=', $this->user->id)->find();
$pet->user_id = NULL;
$pet->abandoned = time();
$pet->save();
Hint::success('You have abandoned ' . $pet->name . '.');
}
$this->redirect(Route::get('pets')->uri());
} catch (ORM_Validation_Exception $e) {
Hint::error($e->errors('models'));
}
}
$this->view = new View_Pet_Index();
$pets = ORM::factory('User_Pet')->where('user_id', '=', $this->user->id)->order_by('active', 'desc');
$paginate = Paginate::factory($pets)->execute();
$this->view->pagination = $paginate->render();
$this->view->pets = $paginate->result();
$this->view->pets_count = count($pets);
$this->view->href = array('create' => Route::url('pet.create'), 'adopt' => Route::url('pet.adopt'));
}
示例9: addSubmenu
/**
* Configure the Linkbar.
*
* @param string The name of the active view.
*/
public static function addSubmenu($vName)
{
Submenu::addEntry(Lang::txt('COM_LANGUAGES_SUBMENU_INSTALLED_SITE'), Route::url('index.php?option=com_languages&view=installed&client=0'), $vName == 'installed');
Submenu::addEntry(Lang::txt('COM_LANGUAGES_SUBMENU_INSTALLED_ADMINISTRATOR'), Route::url('index.php?option=com_languages&view=installed&client=1'), $vName == 'installed');
Submenu::addEntry(Lang::txt('COM_LANGUAGES_SUBMENU_CONTENT'), Route::url('index.php?option=com_languages&view=languages'), $vName == 'languages');
Submenu::addEntry(Lang::txt('COM_LANGUAGES_SUBMENU_OVERRIDES'), Route::url('index.php?option=com_languages&view=overrides'), $vName == 'overrides');
}
示例10: action_index
/**
* Action: index
*/
public function action_index()
{
// Load group(s)
$group_id = (int) $this->request->param('id');
$actions = array();
if (!$group_id) {
// All groups
$groups = Model_Forum_Group::factory()->find_all();
if (Permission::has(new Model_Forum_Group(), Model_Forum_Group::PERMISSION_CREATE, self::$user)) {
$actions[] = array('link' => Route::url('forum_group_add'), 'text' => '<i class="icon-plus-sign icon-white"></i> ' . __('New group'));
}
} else {
// One group
$group = Model_Forum_Group::factory($group_id);
if (!$group->loaded()) {
throw new Model_Exception($group, $group_id);
}
Permission::required($group, Model_Forum_Group::PERMISSION_READ, self::$user);
if (Permission::has($group, Model_Forum_Group::PERMISSION_UPDATE, self::$user)) {
$actions[] = array('link' => Route::model($group, 'edit'), 'text' => '<i class="icon-edit icon-white"></i> ' . __('Edit group'));
}
if (Permission::has($group, Model_Forum_Group::PERMISSION_CREATE_AREA, self::$user)) {
$actions[] = array('link' => Route::model($group, 'add'), 'text' => '<i class="icon-plus-sign icon-white"></i> ' . __('New area'));
}
$groups = array($group);
}
// Build page
$this->view = new View_Page(count($groups) > 1 ? __('Forum areas') : $groups[0]->name);
$this->view->tab = 'areas';
$this->view->actions = $actions;
foreach ($groups as $group) {
$this->view->add(View_Page::COLUMN_MAIN, $this->section_group($group));
}
$this->_side_views();
}
示例11: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
echo Form::open();
?>
<fieldset>
<?php
echo Form::control_group(Form::input('name', $this->tag->name, array('class' => 'input-xxlarge', 'maxlength' => 32)), array('name' => __('Name')), Arr::get($this->errors, 'name'));
?>
<?php
echo Form::control_group(Form::input('description', $this->tag->description, array('class' => 'input-xxlarge')), array('description' => __('Short description')), Arr::get($this->errors, 'description'));
?>
</fieldset>
<fieldset class="form-actions">
<?php
echo Form::button('save', __('Save'), array('type' => 'submit', 'class' => 'btn btn-success btn-large'));
?>
<?php
echo HTML::anchor(Request::back(Route::url('tags'), true), __('Cancel'), array('class' => 'cancel'));
?>
</fieldset>
<?php
echo Form::close();
return ob_get_clean();
}
示例12: action_status
public function action_status()
{
$status = (bool) $this->request->param('id');
Model_Config::set_value('general', 'cron', $status);
Alert::set(Alert::SUCCESS, __('General Configuration updated'));
$this->redirect(Route::url('oc-panel', array('controller' => 'crontab')));
}
示例13: on_page_load
public function on_page_load()
{
$email_ctx_id = $this->get('email_id_ctx', 'email');
$email = $this->_ctx->get($email_ctx_id);
$referrer_page = Request::current()->referrer();
$next_page = $this->get('next_url', Request::current()->referrer());
if (!Valid::email($email)) {
Messages::errors(__('Use a valid e-mail address.'));
HTTP::redirect($referrer_page);
}
$user = ORM::factory('user', array('email' => $email));
if (!$user->loaded()) {
Messages::errors(__('No user found!'));
HTTP::redirect($referrer_page);
}
$reflink = ORM::factory('user_reflink')->generate($user, 'forgot', array('next_url' => URL::site($this->next_url, TRUE)));
if (!$reflink) {
Messages::errors(__('Reflink generate error'));
HTTP::redirect($referrer_page);
}
Observer::notify('admin_login_forgot_before', $user);
try {
Email_Type::get('user_request_password')->send(array('username' => $user->username, 'email' => $user->email, 'reflink' => Route::url('reflink', array('code' => $reflink)), 'code' => $reflink));
Messages::success(__('Email with reflink send to address set in your profile'));
} catch (Exception $e) {
Messages::error(__('Something went wrong'));
}
HTTP::redirect($next_page);
}
示例14: action_pay
/**
* [action_form] generates the form to pay at paypal
*/
public function action_pay()
{
$this->auto_render = FALSE;
$order_id = $this->request->param('id');
$order = new Model_Order();
$order->where('id_order', '=', $order_id)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
// case when selling advert
if ($order->id_product == Model_Order::PRODUCT_AD_SELL) {
$paypal_account = $order->ad->paypal_account();
$currency = i18n::get_intl_currency_symbol();
if (isset($order->ad->cf_shipping) and Valid::numeric($order->ad->cf_shipping) and $order->ad->cf_shipping > 0) {
$order->amount = $order->amount + $order->ad->cf_shipping;
}
} else {
$paypal_account = core::config('payment.paypal_account');
$currency = core::config('payment.paypal_currency');
}
$paypal_url = Core::config('payment.sandbox') ? Paypal::url_sandbox_gateway : Paypal::url_gateway;
$paypal_data = array('order_id' => $order_id, 'amount' => number_format($order->amount, 2, '.', ''), 'site_name' => core::config('general.site_name'), 'site_url' => URL::base(TRUE), 'paypal_url' => $paypal_url, 'paypal_account' => $paypal_account, 'paypal_currency' => $currency, 'item_name' => $order->description);
$this->template = View::factory('paypal', $paypal_data);
$this->response->body($this->template->render());
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->redirect(Route::url('default'));
}
}
示例15: menu_add
public function menu_add($orm)
{
if ($this->acl->is_allowed($this->user, $orm, 'edit')) {
$back_url = $_SERVER['REQUEST_URI'] . urlencode('#tab-') . $this->tab_code;
return array('blog' => array('sub' => array('add' => array('title' => __('Add post'), 'link' => Route::url('modules', array('controller' => $this->controller_name, 'action' => 'edit', 'query' => 'group=' . $this->blog_group . '&blog=' . $orm->id . '&back_url=' . $back_url))))));
}
}