本文整理汇总了PHP中url::merge方法的典型用法代码示例。如果您正苦于以下问题:PHP url::merge方法的具体用法?PHP url::merge怎么用?PHP url::merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类url
的用法示例。
在下文中一共展示了url::merge方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: feed
public function feed($module_id, $feed_id, $id = null)
{
$page = $this->input->get("page", 1);
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
}
// Configurable page size between 1 and 100, default 20
$page_size = max(1, min(100, $this->input->get("page_size", self::$page_size)));
// Run the appropriate feed callback
if (module::is_active($module_id)) {
$class_name = "{$module_id}_rss";
if (method_exists($class_name, "feed")) {
$feed = call_user_func(array($class_name, "feed"), $feed_id, ($page - 1) * $page_size, $page_size, $id);
}
}
if (empty($feed)) {
Kohana::show_404();
}
if ($feed->max_pages && $page > $feed->max_pages) {
url::redirect(url::merge(array("page" => $feed->max_pages)));
}
$view = new View(empty($feed->view) ? "feed.mrss" : $feed->view);
unset($feed->view);
$view->feed = $feed;
$view->pub_date = date("D, d M Y H:i:s T");
$feed->uri = url::abs_site(Router::$current_uri);
if ($page > 1) {
$feed->previous_page_uri = url::abs_site(url::merge(array("page" => $page - 1)));
}
if ($page < $feed->max_pages) {
$feed->next_page_uri = url::abs_site(url::merge(array("page" => $page + 1)));
}
rest::http_content_type(rest::RSS);
print $view;
}
示例2: index
public function index()
{
$view = new Admin_View("admin.html");
$view->page_title = t("Users and groups");
$view->page_type = "collection";
$view->page_subtype = "admin_users";
$view->content = new View("admin_users.html");
// @todo: add this as a config option
$page_size = module::get_var("user", "page_size", 10);
$page = Input::instance()->get("page", "1");
$builder = db::build();
$user_count = $builder->from("users")->count_records();
// Pagination info
$view->page = $page;
$view->page_size = $page_size;
$view->children_count = $user_count;
$view->max_pages = ceil($view->children_count / $view->page_size);
$view->content->pager = new Pagination();
$view->content->pager->initialize(array("query_string" => "page", "total_items" => $user_count, "items_per_page" => $page_size, "style" => "classic"));
// Make sure that the page references a valid offset
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
} else {
if ($page > $view->content->pager->total_pages) {
url::redirect(url::merge(array("page" => $view->content->pager->total_pages)));
}
}
// Join our users against the items table so that we can get a count of their items
// in the same query.
$view->content->users = ORM::factory("user")->order_by("users.name", "ASC")->find_all($page_size, $view->content->pager->sql_offset);
$view->content->groups = ORM::factory("group")->order_by("name", "ASC")->find_all();
print $view;
}
示例3: index
public function index()
{
// Set up a new admin page for the quotas module.
$view = new Admin_View("admin.html");
$view->page_title = t("Users and groups");
$view->page_type = "collection";
$view->page_subtype = "admin_users_quotas";
$view->content = new View("admin_quotas.html");
$page_size = module::get_var("user", "page_size", 10);
$page = Input::instance()->get("page", "1");
$builder = db::build();
$user_count = $builder->from("users")->count_records();
$view->page = $page;
$view->page_size = $page_size;
$view->children_count = $user_count;
$view->max_pages = ceil($view->children_count / $view->page_size);
$view->content->pager = new Pagination();
$view->content->pager->initialize(array("query_string" => "page", "total_items" => $user_count, "items_per_page" => $page_size, "style" => "classic"));
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
} else {
if ($page > $view->content->pager->total_pages) {
url::redirect(url::merge(array("page" => $view->content->pager->total_pages)));
}
}
$view->content->users = ORM::factory("user")->order_by("users.name", "ASC")->find_all($page_size, $view->content->pager->sql_offset);
$view->content->groups = ORM::factory("group")->order_by("name", "ASC")->find_all();
$view->content->quota_options = $this->_get_quota_settings_form();
print $view;
}
示例4: feed
public function feed($module_id, $feed_id, $id = null)
{
$page = (int) Input::instance()->get("page", 1);
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
}
// Configurable page size between 1 and 100, default 20
$page_size = max(1, min(100, (int) Input::instance()->get("page_size", self::$page_size)));
// Run the appropriate feed callback
if (module::is_active($module_id)) {
$class_name = "{$module_id}_rss";
if (method_exists($class_name, "feed")) {
$feed = call_user_func(array($class_name, "feed"), $feed_id, ($page - 1) * $page_size, $page_size, $id);
}
}
if (empty($feed)) {
throw new Kohana_404_Exception();
}
if ($feed->max_pages && $page > $feed->max_pages) {
url::redirect(url::merge(array("page" => $feed->max_pages)));
}
$view = new View(empty($feed->view) ? "feed.mrss" : $feed->view);
unset($feed->view);
$view->feed = $feed;
$view->pub_date = date("D, d M Y H:i:s T");
$feed->uri = url::abs_site(url::merge($_GET));
if ($page > 1) {
$feed->previous_page_uri = url::abs_site(url::merge(array("page" => $page - 1)));
}
if ($page < $feed->max_pages) {
$feed->next_page_uri = url::abs_site(url::merge(array("page" => $page + 1)));
}
header("Content-Type: application/rss+xml");
print $view;
}
示例5: _show
private function _show($album)
{
$page_size = module::get_var("gallery", "page_size", 9);
$album_defn = unserialize(module::get_var("dynamic", $album));
$input = Input::instance();
$show = $input->get("show");
if ($show) {
$child = ORM::factory("item", $show);
$index = dynamic::get_position($album_defn, $child);
if ($index) {
$page = ceil($index / $page_size);
url::redirect("dynamic/{$album}" . ($page == 1 ? "" : "?page={$page}"));
}
} else {
$page = (int) $input->get("page", "1");
}
$children_count = dynamic::get_display_count($album_defn);
$offset = ($page - 1) * $page_size;
$max_pages = max(ceil($children_count / $page_size), 1);
// Make sure that the page references a valid offset
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
} else {
if ($page > $max_pages) {
url::redirect(url::merge(array("page" => $max_pages)));
}
}
$root = item::root();
$template = new Theme_View("page.html", "collection", "dynamic");
$template->set_global(array("page" => $page, "max_pages" => $max_pages, "page_size" => $page_size, "children" => dynamic::items($album_defn->key_field, $page_size, $offset), "breadcrumbs" => array(Breadcrumb::instance($root->title, $root->url())->set_first(), Breadcrumb::instance($album_defn->title, url::site("dynamic/{$album}"))->set_last()), "children_count" => $children_count));
$template->content = new View("dynamic.html");
$template->content->title = t($album_defn->title);
print $template;
item::set_display_context_callback("Dynamic_Controller::get_display_context", $album_defn, $album);
}
示例6: xss_in_merged_url_test
public function xss_in_merged_url_test()
{
Router::$current_uri = "foo/<xss>/bar";
Router::$complete_uri = "foo/<xss>/bar?foo=bar";
$_GET = array("foo" => "bar");
$this->assert_same("foo/<xss>/bar?foo=bar", url::merge(array()));
$this->assert_same("foo/<xss>/bar?foo=bar&a=b", url::merge(array("a" => "b")));
}
示例7: get
static function get($block_id)
{
$block = new Block();
switch ($block_id) {
case "user_info":
$block->css_id = "g-user_info";
$block->title = t("User Information");
$block->content = new View("admin_block_user_info.html");
$block->content->number_of_records = ORM::factory("user_info")->count_all();
// helps build the pagniation
$page_size = module::get_var("user_info", "per_page");
$page = Input::instance()->get("page", "1");
$builder = db::build();
$user_count = $builder->from("user_infos")->count_records();
$block->content->pager = new Pagination();
$block->content->pager->initialize(array("query_string" => "page", "total_items" => $user_count, "items_per_page" => $page_size, "style" => "classic"));
// Make sure that the page references a valid offset
if ($page < 1) {
// This prevents the admin page from displaying if there are no records in the database, commented out to temp. fix
// url::redirect(url::merge(array("page" => 1)));
url::site("admin");
//This should fix the issue I think
} else {
if ($page > $block->content->pager->total_pages) {
url::redirect(url::merge(array("page" => $block->content->pager->total_pages)));
}
}
// Get the user defined settings for sort by and sort order
$default_sort_column = module::get_var("user_info", "default_sort_column");
$default_sort_order = module::get_var("user_info", "default_sort_order");
$block->content->data = ORM::factory("user_info")->order_by($default_sort_column, $default_sort_order)->find_all($page_size, $block->content->pager->sql_offset);
// $block->content->data = ORM::factory("user_info")->find_all();
$block->content->use_default_gallery_date_format = module::get_var("user_info", "use_default_gallery_date_format");
$block->content->date_format = module::get_var("user_info", "date_format");
$block->content->color_login = module::get_var("user_info", "color_login");
$block->content->color_logout = module::get_var("user_info", "color_logout");
$block->content->color_failed_login = module::get_var("user_info", "color_failed_login");
$block->content->color_re_authenticate_login = module::get_var("user_info", "color_re_authenticate_login");
$block->content->color_user_created = module::get_var("user_info", "color_user_created");
break;
}
return $block;
}
示例8: __call
public function __call($function, $args)
{
$tag_name = $function;
$tag = ORM::factory("tag")->where("name", "=", $tag_name)->find();
$page_size = module::get_var("gallery", "page_size", 9);
$page = (int) Input::instance()->get("page", "1");
$children_count = $tag->items_count();
$offset = ($page - 1) * $page_size;
$max_pages = max(ceil($children_count / $page_size), 1);
// Make sure that the page references a valid offset
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
} else {
if ($page > $max_pages) {
url::redirect(url::merge(array("page" => $max_pages)));
}
}
$template = new Theme_View("page.html", "collection", "tag");
$template->set_global(array("page" => $page, "max_pages" => $max_pages, "page_size" => $page_size, "tag" => $tag, "children" => $tag->items($page_size, $offset), "children_count" => $children_count));
$template->content = new View("dynamic.html");
$template->content->title = t("Tag: %tag_name", array("tag_name" => $tag->name));
print $template;
}
示例9: paginator
/**
* Set up the data and render a pager.
*
* See themes/wind/views/pager.html for documentation on the variables generated here.
*/
public function paginator()
{
$v = new View("paginator.html");
$v->page_type = $this->page_type;
$v->page_subtype = $this->page_subtype;
$v->first_page_url = null;
$v->previous_page_url = null;
$v->next_page_url = null;
$v->last_page_url = null;
if ($this->page_type == "collection") {
$v->page = $this->page;
$v->max_pages = $this->max_pages;
$v->total = $this->children_count;
if ($this->page != 1) {
$v->first_page_url = url::site(url::merge(array("page" => 1)));
$v->previous_page_url = url::site(url::merge(array("page" => $this->page - 1)));
}
if ($this->page != $this->max_pages) {
$v->next_page_url = url::site(url::merge(array("page" => $this->page + 1)));
$v->last_page_url = url::site(url::merge(array("page" => $this->max_pages)));
}
$v->first_visible_position = ($this->page - 1) * $this->page_size + 1;
$v->last_visible_position = min($this->page * $this->page_size, $v->total);
} else {
if ($this->page_type == "item") {
$v->position = $this->position;
$v->total = $this->sibling_count;
if ($this->previous_item) {
$v->previous_page_url = $this->previous_item->url();
}
if ($this->next_item) {
$v->next_page_url = $this->next_item->url();
}
}
}
return $v;
}
示例10: __call
public function __call($function, $args)
{
$tag_id = $function;
$tag = ORM::factory("tag")->where("id", "=", $tag_id)->find();
$page_size = module::get_var("gallery", "page_size", 9);
$input = Input::instance();
$show = $input->get("show");
if ($show) {
$child = ORM::factory("item", $show);
$index = tag::get_position($tag, $child);
if ($index) {
$page = ceil($index / $page_size);
$uri = "tag/{$tag_id}/" . urlencode($tag->name);
url::redirect($uri . ($page == 1 ? "" : "?page={$page}"));
}
} else {
$page = (int) $input->get("page", "1");
}
$children_count = $tag->items_count();
$offset = ($page - 1) * $page_size;
$max_pages = max(ceil($children_count / $page_size), 1);
// Make sure that the page references a valid offset
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
} else {
if ($page > $max_pages) {
url::redirect(url::merge(array("page" => $max_pages)));
}
}
$root = item::root();
$template = new Theme_View("page.html", "collection", "tag");
$template->set_global(array("page" => $page, "max_pages" => $max_pages, "page_size" => $page_size, "tag" => $tag, "children" => $tag->items($page_size, $offset), "breadcrumbs" => array(Breadcrumb::instance($root->title, $root->url())->set_first(), Breadcrumb::instance(t("Tag: %tag_name", array("tag_name" => $tag->name)), $tag->url())->set_last()), "children_count" => $children_count));
$template->content = new View("dynamic.html");
$template->content->title = t("Tag: %tag_name", array("tag_name" => $tag->name));
print $template;
item::set_display_context_callback("Tag_Controller::get_display_context", $tag->id);
}
示例11: elseif
} elseif ($page_type == "") {
}
$i++;
}
} else {
// End rWatcher Mod.
switch ($page_type) {
case "collection":
if (isset($item)) {
$parent = $item->parent();
}
$current_page = $page;
$total_pages = $max_pages;
// Prepare page url list
for ($i = 1; $i <= $total_pages; $i++) {
$_pagelist[$i] = url::site(url::merge(array("page" => $i)));
}
break;
case "item":
if (isset($item)) {
$parent = $item->parent();
}
if (isset($position)) {
$current_page = $position;
} else {
$current_page = 1;
}
$total_pages = $total;
if (isset($parent)) {
$siblings = $parent->children();
for ($i = 1; $i <= $total; $i++) {
示例12: t
<a href="<?php
echo url::site(url::merge(array("page" => $page - 1)));
?>
" accesskey="z">« <?php
echo t("Previous");
?>
</a>
<?php
}
?>
<?php
if ($page != $max_pages) {
?>
<a id="next-page" href="<?php
echo url::site(url::merge(array("page" => $page + 1)));
?>
" accesskey="x"><?php
echo t("Next");
?>
»</a>
<?php
}
?>
</p>
<?php
if (access::can("add", $item) || access::can("edit", $item)) {
?>
<p><em class="count">Actions</em></p>
<ul>
示例13: t
if ($album->id == item::root()->id) {
?>
<div>
<?php
echo t("Searched the whole gallery.");
?>
</div>
<?php
} else {
?>
<div>
<?php
echo t("Searched within album <b>%album</b>.", array("album" => html::purify($album->title)));
?>
<a href="<?php
echo url::site(url::merge(array("album" => item::root()->id)));
?>
"><?php
echo t("Search whole gallery");
?>
</a>
</div>
<?php
}
?>
<?php
if (count($items)) {
?>
<ul id="g-album-grid" class="ui-helper-clearfix">
<?php