當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PageRequestEvent::get_search_terms方法代碼示例

本文整理匯總了PHP中PageRequestEvent::get_search_terms方法的典型用法代碼示例。如果您正苦於以下問題:PHP PageRequestEvent::get_search_terms方法的具體用法?PHP PageRequestEvent::get_search_terms怎麽用?PHP PageRequestEvent::get_search_terms使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PageRequestEvent的用法示例。


在下文中一共展示了PageRequestEvent::get_search_terms方法的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_search_terms方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。