当前位置: 首页>>代码示例>>PHP>>正文


PHP PageRequestEvent::get_page_number方法代码示例

本文整理汇总了PHP中PageRequestEvent::get_page_number方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRequestEvent::get_page_number方法的具体用法?PHP PageRequestEvent::get_page_number怎么用?PHP PageRequestEvent::get_page_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PageRequestEvent的用法示例。


在下文中一共展示了PageRequestEvent::get_page_number方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onPageRequest

 public function onPageRequest(PageRequestEvent $event)
 {
     if ($event->page_matches("rss/images")) {
         $search_terms = $event->get_search_terms();
         $page_number = $event->get_page_number();
         $page_size = $event->get_page_size();
         $images = Image::find_images(($page_number - 1) * $page_size, $page_size, $search_terms);
         $this->do_rss($images, $search_terms, $page_number);
     }
 }
开发者ID:JarJak,项目名称:shimmie2,代码行数:10,代码来源:main.php

示例2: onPageRequest

 public function onPageRequest(PageRequestEvent $event)
 {
     global $page, $user;
     if ($event->page_matches("api/shimmie")) {
         $page->set_mode("data");
         $page->set_type("text/plain");
         if ($event->page_matches("api/shimmie/get_tags")) {
             $tag = $event->get_arg(0);
             if (empty($tag) && isset($_GET['tag'])) {
                 $tag = $_GET['tag'];
             }
             $res = $this->api_get_tags($tag);
             $page->set_data(json_encode($res));
         } elseif ($event->page_matches("api/shimmie/get_image")) {
             $arg = $event->get_arg(0);
             if (empty($arg) && isset($_GET['id'])) {
                 $arg = $_GET['id'];
             }
             $image = Image::by_id(int_escape($arg));
             // FIXME: handle null image
             $image->get_tag_array();
             // tag data isn't loaded into the object until necessary
             $safe_image = new _SafeImage($image);
             $page->set_data(json_encode($safe_image));
         } elseif ($event->page_matches("api/shimmie/find_images")) {
             $search_terms = $event->get_search_terms();
             $page_number = $event->get_page_number();
             $page_size = $event->get_page_size();
             $images = Image::find_images(($page_number - 1) * $page_size, $page_size, $search_terms);
             $safe_images = array();
             foreach ($images as $image) {
                 $image->get_tag_array();
                 $safe_images[] = new _SafeImage($image);
             }
             $page->set_data(json_encode($safe_images));
         } elseif ($event->page_matches("api/shimmie/get_user")) {
             $query = $user->id;
             $type = "id";
             if ($event->count_args() == 1) {
                 $query = $event->get_arg(0);
                 $type = "name";
             } elseif (isset($_GET['id'])) {
                 $query = $_GET['id'];
             } elseif (isset($_GET['name'])) {
                 $query = $_GET['name'];
                 $type = "name";
             }
             $all = $this->api_get_user($type, $query);
             $page->set_data(json_encode($all));
         } else {
             $page->set_mode("redirect");
             $page->set_redirect(make_link("ext_doc/shimmie_api"));
         }
     }
 }
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:55,代码来源:main.php

示例3: onPageRequest

 public function onPageRequest(PageRequestEvent $event)
 {
     global $database, $page;
     if ($event->page_matches("api/shimmie")) {
         $page->set_mode("data");
         $page->set_type("text/plain");
         if ($event->page_matches("api/shimmie/get_tags")) {
             if ($event->count_args() == 2) {
                 $all = $database->get_all("SELECT tag FROM tags WHERE tag LIKE ?", array($event->get_arg(0) . "%"));
             } else {
                 $all = $database->get_all("SELECT tag FROM tags");
             }
             $res = array();
             foreach ($all as $row) {
                 $res[] = $row["tag"];
             }
             $page->set_data(json_encode($res));
         }
         if ($event->page_matches("api/shimmie/get_image")) {
             $image = Image::by_id(int_escape($event->get_arg(0)));
             $image->get_tag_array();
             // tag data isn't loaded into the object until necessary
             $safe_image = new _SafeImage($image);
             $page->set_data(json_encode($safe_image));
         }
         if ($event->page_matches("api/shimmie/find_images")) {
             $search_terms = $event->get_search_terms();
             $page_number = $event->get_page_number();
             $page_size = $event->get_page_size();
             $images = Image::find_images(($page_number - 1) * $page_size, $page_size, $search_terms);
             $safe_images = array();
             foreach ($images as $image) {
                 $image->get_tag_array();
                 $safe_images[] = new _SafeImage($image);
             }
             $page->set_data(json_encode($safe_images));
         }
     }
 }
开发者ID:jackrabbitjoey,项目名称:shimmie2,代码行数:39,代码来源:main.php


注:本文中的PageRequestEvent::get_page_number方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。