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


PHP FileData::filepath方法代码示例

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


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

示例1: action_index


//.........这里部分代码省略.........
         //                        'relevance' => $audio->relevance);
         //                    $i++;
         //                }
         //            }
     }
     //video
     //Заголовок, описание и язык(video)
     if ($c == 'all' || strpos($c, 'video') !== false) {
         $sql = "SELECT DISTINCT video.*,\n                  MATCH (title) AGAINST ({$search} IN BOOLEAN MODE) AS relevance\n                  FROM video\n                  WHERE MATCH (title) AGAINST ({$search} IN BOOLEAN MODE)\n                  AND published = '1'\n                  AND language = '{$this->language}'\n                  ORDER BY relevance DESC";
         /*$sql = "SELECT DISTINCT video.*,
           MATCH (title) AGAINST ($search) AS relevance
           FROM video
           WHERE MATCH (title) AGAINST ($search)
           AND published = '1'
           AND language = '$this->language'
           ORDER BY relevance DESC";*/
         $videos = DB::query(Database::SELECT, $sql)->as_object()->execute();
         foreach ($videos as $video) {
             if (!empty($video->{'title'})) {
                 $results[$i] = array('type' => 'video', 'id' => $video->id, 'title' => $video->title, 'desc' => $video->description, 'controller' => 'video', 'relevance' => $video->relevance);
                 $i++;
             }
         }
     }
     // biography
     // Заголовки, описание и текст биографий (biography)
     if ($c == 'all' || strpos($c, 'biographies') !== false) {
         $sql = "SELECT DISTINCT biography.*,\n                  MATCH (name_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search} IN BOOLEAN MODE) AS relevance\n                  FROM biography\n                  WHERE MATCH (name_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search} IN BOOLEAN MODE)\n                  AND published = '1'\n                  ORDER BY relevance DESC";
         $bios = DB::query(Database::SELECT, $sql)->as_object()->execute();
         foreach ($bios as $bio) {
             if (!empty($bio->{'name_' . $this->language}) and !empty($bio->{'desc_' . $this->language})) {
                 $results[$i] = array('type' => 'bio', 'id' => $bio->id, 'title' => $bio->{'name_' . $this->language}, 'desc' => $bio->{'desc_' . $this->language}, 'controller' => 'biography', 'relevance' => $bio->relevance);
                 if ($bio->image != 0) {
                     $results[$i]['image'] = FileData::filepath($bio->image);
                 }
                 $i++;
             }
         }
     }
     //Заголовки, описание и текст статей (publications)
     if ($c == 'all' || strpos($c, 'publication') !== false) {
         /* Разбить на 2 запроса можно, чтобы искал сначала в заголовке, но статьи дублируются
             * $sql = "SELECT DISTINCT publications.*,
                  MATCH (title_$this->language) AGAINST ($search IN BOOLEAN MODE) AS relevance
                  FROM publications
                  WHERE MATCH (title_$this->language) AGAINST ($search IN BOOLEAN MODE)
                  AND published = '1'
                  ORDER BY relevance DESC";
            $pages = DB::query(Database::SELECT, $sql)->as_object()->execute();
            foreach ($pages as $page) {
                if (!empty($page->{'title_' . $this->language}) AND !empty($page->{'desc_' . $this->language})) {
                    $results[$i] = array('type' => 'news', 'id' => $page->id,
                        'title' => $page->{'title_' . $this->language},
                        'desc' => $page->{'desc_' . $this->language},
                        'controller' => 'publications',
                        'relevance' => $page->relevance
                    );
                    if ($page->image != 0) {
                        $results[$i]['image'] = FileData::filepath($page->image);
                    }
                    $i++;
                }
            }
            $sql = "SELECT DISTINCT publications.*,
                  MATCH (desc_$this->language, text_$this->language) AGAINST ($search IN BOOLEAN MODE) AS relevance
                  FROM publications
开发者ID:HappyKennyD,项目名称:teest,代码行数:67,代码来源:Search.php

示例2: action_index

 public function action_index()
 {
     $search = $this->request->param('string', "");
     $search = Security::xss_clean(mysql_real_escape_string($search));
     $this->add_cumb('Search', 'search');
     if (!empty($search)) {
         $this->add_cumb($search, '');
     }
     if (empty($search)) {
         $search = Security::xss_clean(Arr::get($_POST, 'search', ''));
         if (!empty($search)) {
             $this->redirect('search/' . $search, 301);
         }
     }
     $this->set('search', $search);
     $query_b = '%' . $search . '%';
     $search = Database::instance()->escape($search);
     //$results = new Massiv();
     $images = array();
     $i = 0;
     /* Таблицы:
        biography (name, desc, text)
        books (title, author, description)
        calendar (title, desc, text)
        news (title, desc, text)
        pages_contents (title, description, text)
        publications (title, desc, text)
        */
     $query_a = DB::expr(' AGAINST(' . $search . ') ');
     //Заголовки, описание и текст биографий
     $sql = "SELECT DISTINCT biography.*,\n              MATCH (name_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search}) AS relevance\n              FROM biography\n              WHERE MATCH (name_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search})\n              AND published = '1'\n              ORDER BY relevance DESC";
     $bios = DB::query(Database::SELECT, $sql)->as_object()->execute();
     foreach ($bios as $bio) {
         if (!empty($bio->{'name_' . $this->language}) and !empty($bio->{'desc_' . $this->language})) {
             $results[$i] = array('type' => 'bio', 'id' => $bio->id, 'title' => $bio->{'name_' . $this->language}, 'desc' => $bio->{'desc_' . $this->language}, 'controller' => 'biography', 'relevance' => $bio->relevance);
             if ($bio->image != 0) {
                 $results[$i]['image'] = FileData::filepath($bio->image);
             }
             $i++;
         }
     }
     //Заголовки, описание и текст страниц
     $sql = "SELECT DISTINCT pages_contents.*,\n              MATCH (title_{$this->language}, description_{$this->language}, text_{$this->language}) AGAINST ({$search}) AS relevance\n              FROM pages_contents\n              WHERE MATCH (title_{$this->language}, description_{$this->language}, text_{$this->language}) AGAINST ({$search})\n              AND published = '1'\n              ORDER BY relevance DESC";
     $pages = DB::query(Database::SELECT, $sql)->as_object()->execute();
     foreach ($pages as $page) {
         if (!empty($page->{'title_' . $this->language}) and !empty($page->{'description_' . $this->language})) {
             $results[$i] = array('type' => 'page', 'id' => $page->id, 'title' => $page->{'title_' . $this->language}, 'desc' => $page->{'description_' . $this->language}, 'controller' => 'contents', 'relevance' => $page->relevance);
             if ($page->image != 0) {
                 $results[$i]['image'] = FileData::filepath($page->image);
             }
             $i++;
         }
     }
     //Заголовки книг, авторы
     $sql = "SELECT DISTINCT books.*,\n              MATCH (title, author, description) AGAINST ({$search}) AS relevance\n              FROM books\n              WHERE MATCH (title, author, description) AGAINST ({$search})\n              AND published = '1'\n              AND show_{$this->language} = '1'\n              ORDER BY relevance DESC";
     $books = DB::query(Database::SELECT, $sql)->as_object()->execute();
     foreach ($books as $book) {
         $book->description = strip_tags($book->description);
         $desc = preg_replace('[<br/>|<br />|<p>]', ' ', $book->description);
         $desc = mb_substr(htmlspecialchars(Security::xss_clean(trim(strip_tags($desc)))), 0, 200);
         $last = strripos($desc, ' ');
         $desc = substr($desc, 0, $last + 1);
         $desc .= '...';
         $results[$i] = array('type' => 'book', 'id' => $book->id, 'title' => $book->title, 'desc' => $desc, 'controller' => 'books', 'relevance' => $book->relevance);
         $i++;
     }
     //Заголовки, описание и текст новостей
     $sql = "SELECT DISTINCT news.*,\n              MATCH (title_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search}) AS relevance\n              FROM news\n              WHERE MATCH (title_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search})\n              AND published = '1'\n              ORDER BY relevance DESC";
     $news = DB::query(Database::SELECT, $sql)->as_object()->execute();
     foreach ($news as $page) {
         if (!empty($page->{'title_' . $this->language}) and !empty($page->{'desc_' . $this->language})) {
             $results[$i] = array('type' => 'news', 'id' => $page->id, 'title' => $page->{'title_' . $this->language}, 'desc' => $page->{'desc_' . $this->language}, 'controller' => 'news', 'relevance' => $page->relevance);
             if ($page->image != 0) {
                 $results[$i]['image'] = FileData::filepath($page->image);
             }
             $i++;
         }
     }
     //Заголовки, описание и текст статей
     $sql = "SELECT DISTINCT publications.*,\n              MATCH (title_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search}) AS relevance\n              FROM publications\n              WHERE MATCH (title_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search})\n              AND published = '1'\n              ORDER BY relevance DESC";
     $pages = DB::query(Database::SELECT, $sql)->as_object()->execute();
     foreach ($pages as $page) {
         if (!empty($page->{'title_' . $this->language}) and !empty($page->{'desc_' . $this->language})) {
             $results[$i] = array('type' => 'news', 'id' => $page->id, 'title' => $page->{'title_' . $this->language}, 'desc' => $page->{'desc_' . $this->language}, 'controller' => 'publications', 'relevance' => $page->relevance);
             if ($page->image != 0) {
                 $results[$i]['image'] = FileData::filepath($page->image);
             }
             $i++;
         }
     }
     //Заголовки, описание и текст календаря
     $sql = "SELECT DISTINCT calendar.*,\n              MATCH (title_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search}) AS relevance\n              FROM calendar\n              WHERE MATCH (title_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search})\n              AND published = '1'\n              ORDER BY relevance DESC";
     $pages = DB::query(Database::SELECT, $sql)->as_object()->execute();
     foreach ($pages as $page) {
         if (!empty($page->{'title_' . $this->language}) and !empty($page->{'desc_' . $this->language})) {
             $results[$i] = array('type' => 'news', 'id' => $page->id, 'title' => $page->{'title_' . $this->language}, 'desc' => $page->{'desc_' . $this->language}, 'controller' => 'calendar', 'relevance' => $page->relevance);
             if ($page->image != 0) {
                 $results[$i]['image'] = FileData::filepath($page->image);
             }
             $i++;
//.........这里部分代码省略.........
开发者ID:HappyKennyD,项目名称:teest,代码行数:101,代码来源:Search_b.php

示例3: action_index


//.........这里部分代码省略.........
         $sql = "SELECT DISTINCT video.*,\n                  MATCH (title) AGAINST ({$search} IN BOOLEAN MODE) AS relevance\n                  FROM video\n                  WHERE MATCH (title) AGAINST ({$search} IN BOOLEAN MODE)\n                  AND published = '1'\n                  AND language = '{$this->language}'\n                  ORDER BY relevance DESC";
         /*$sql = "SELECT DISTINCT video.*,
           MATCH (title) AGAINST ($search) AS relevance
           FROM video
           WHERE MATCH (title) AGAINST ($search)
           AND published = '1'
           AND language = '$this->language'
           ORDER BY relevance DESC";*/
         $videos = DB::query(Database::SELECT, $sql)->as_object()->execute();
         $ids_video = ORM::factory('Material_Project')->where('project_id', '=', $id_project)->and_where('type', '=', 'video')->find_all()->as_array(NULL, 'material_id');
         foreach ($videos as $video) {
             if (!empty($video->{'title'})) {
                 if (in_array($video->id, $ids_video)) {
                     $results[$i] = array('type' => 'video', 'id' => $video->id, 'title' => $video->title, 'inc' => 'true', 'desc' => $video->description, 'controller' => 'video', 'relevance' => $video->relevance);
                     $i++;
                 } else {
                     $results[$i] = array('type' => 'video', 'id' => $video->id, 'title' => $video->title, 'inc' => 'false', 'desc' => $video->description, 'controller' => 'video', 'relevance' => $video->relevance);
                     $i++;
                 }
             }
         }
     }
     // biography
     // Заголовки, описание и текст биографий (biography)
     if ($c == 'all' || strpos($c, 'biographies') !== false) {
         $sql = "SELECT DISTINCT biography.*,\n                  MATCH (name_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search} IN BOOLEAN MODE) AS relevance\n                  FROM biography\n                  WHERE MATCH (name_{$this->language}, desc_{$this->language}, text_{$this->language}) AGAINST ({$search} IN BOOLEAN MODE)\n                  AND published = '1'\n                  ORDER BY relevance DESC";
         $bios = DB::query(Database::SELECT, $sql)->as_object()->execute();
         $ids_bios = ORM::factory('Material_Project')->where('project_id', '=', $id_project)->and_where('type', '=', 'biography')->find_all()->as_array(NULL, 'material_id');
         foreach ($bios as $bio) {
             if (!empty($bio->{'name_' . $this->language}) and !empty($bio->{'desc_' . $this->language})) {
                 if (in_array($bio->id, $ids_bios)) {
                     $results[$i] = array('type' => 'bio', 'id' => $bio->id, 'inc' => 'true', 'title' => $bio->{'name_' . $this->language}, 'desc' => $bio->{'desc_' . $this->language}, 'controller' => 'biography', 'relevance' => $bio->relevance);
                     if ($bio->image != 0) {
                         $results[$i]['image'] = FileData::filepath($bio->image);
                     }
                     $i++;
                 } else {
                     $results[$i] = array('type' => 'bio', 'id' => $bio->id, 'inc' => 'false', 'title' => $bio->{'name_' . $this->language}, 'desc' => $bio->{'desc_' . $this->language}, 'controller' => 'biography', 'relevance' => $bio->relevance);
                     if ($bio->image != 0) {
                         $results[$i]['image'] = FileData::filepath($bio->image);
                     }
                     $i++;
                 }
             }
         }
     }
     //Заголовки, описание и текст статей (publications)
     if ($c == 'all' || strpos($c, 'news') !== false) {
         //Заголовки, описание и текст страниц (pages_contents)
         $sql = "SELECT DISTINCT pages_contents.*,\n                              MATCH (title_{$this->language}, description_{$this->language}, text_{$this->language}) AGAINST ({$search} IN BOOLEAN MODE) AS relevance\n                              FROM pages_contents\n                              WHERE MATCH (title_{$this->language}, description_{$this->language}, text_{$this->language}) AGAINST ({$search} IN BOOLEAN MODE)\n                              AND published = '1'\n                              ORDER BY relevance DESC";
         /*$sql = "SELECT DISTINCT pages_contents.*,
           MATCH (title_$this->language, description_$this->language, text_$this->language) AGAINST ($search) AS relevance
           FROM pages_contents
           WHERE MATCH (title_$this->language, description_$this->language, text_$this->language) AGAINST ($search)
           AND published = '1'
           ORDER BY relevance DESC";*/
         $pages = DB::query(Database::SELECT, $sql)->as_object()->execute();
         $ids_news = ORM::factory('Material_Project')->where('project_id', '=', $id_project)->and_where('type', 'IN', array('contents'))->find_all()->as_array(NULL, 'material_id');
         foreach ($pages as $page) {
             if (!empty($page->{'title_' . $this->language}) and !empty($page->{'description_' . $this->language})) {
                 if (in_array($page->id, $ids_news)) {
                     $results[$i] = array('type' => 'page', 'id' => $page->id, 'title' => $page->{'title_' . $this->language}, 'desc' => $page->{'description_' . $this->language}, 'controller' => 'contents', 'inc' => 'true', 'relevance' => $page->relevance);
                     if ($page->image != 0) {
                         $results[$i]['image'] = FileData::filepath($page->image);
                     }
                     $i++;
开发者ID:HappyKennyD,项目名称:teest,代码行数:67,代码来源:Search.php


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