summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/helpers/comment_event.php11
-rw-r--r--modules/comment/helpers/comment_search.php34
-rw-r--r--modules/gallery/helpers/gallery_event.php6
-rw-r--r--modules/gallery/helpers/gallery_search.php24
-rw-r--r--modules/search/helpers/search.php12
-rw-r--r--modules/tag/helpers/tag_event.php4
-rw-r--r--modules/tag/helpers/tag_search.php24
7 files changed, 25 insertions, 90 deletions
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php
index 614c7c65..0234aea9 100644
--- a/modules/comment/helpers/comment_event.php
+++ b/modules/comment/helpers/comment_event.php
@@ -38,4 +38,15 @@ class comment_event_Core {
->url("#comments")
->css_id("gCommentsLink"));
}
+
+ static function item_index_data($item, $data) {
+ foreach (Database::instance()
+ ->select("text")
+ ->from("comments")
+ ->where("item_id", $item->id)
+ ->get()
+ ->as_array() as $row) {
+ $data[] = $row->text;
+ }
+ }
}
diff --git a/modules/comment/helpers/comment_search.php b/modules/comment/helpers/comment_search.php
deleted file mode 100644
index 29762eae..00000000
--- a/modules/comment/helpers/comment_search.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2009 Bharat Mediratta
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-class Comment_Search_Core {
- static function item_index_data($item) {
- $data = array();
- foreach (Database::instance()
- ->select("text")
- ->from("comments")
- ->where("item_id", $item->id)
- ->get()
- ->as_array() as $row) {
- $data[] = $row->text;
- }
- return join(" ", $data);
- }
-}
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 1cd96372..64f2a9ff 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -47,4 +47,10 @@ class gallery_event_Core {
module::clear_var("gallery", "choose_default_tookit");
}
}
+
+ static function item_index_data($item, $data) {
+ $data[] = $item->description;
+ $data[] = $item->name;
+ $data[] = $item->title;
+ }
}
diff --git a/modules/gallery/helpers/gallery_search.php b/modules/gallery/helpers/gallery_search.php
deleted file mode 100644
index 2a4029d3..00000000
--- a/modules/gallery/helpers/gallery_search.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2009 Bharat Mediratta
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-class gallery_search_Core {
- static function item_index_data($item) {
- return join(" ", array($item->description, $item->name, $item->title));
- }
-}
diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php
index b08cf89d..c03de983 100644
--- a/modules/search/helpers/search.php
+++ b/modules/search/helpers/search.php
@@ -64,19 +64,15 @@ class search_Core {
}
static function update($item) {
- $data = array();
+ $data = new ArrayObject();
$record = ORM::factory("search_record")->where("item_id", $item->id)->find();
if (!$record->loaded) {
$record->item_id = $item->id;
}
- foreach (module::active() as $module) {
- $class_name = "{$module->name}_search";
- if (method_exists($class_name, "item_index_data")) {
- $data[] = call_user_func(array($class_name, "item_index_data"), $record->item());
- }
- }
- $record->data = join(" ", $data);
+ module::event("item_index_data", $record->item(), $data);
+ Kohana::log("alert",print_r($data,1));
+ $record->data = join(" ", (array)$data);
$record->dirty = 0;
$record->save();
}
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index f5fa6d4c..57986e40 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -93,4 +93,8 @@ class tag_event_Core {
->label(t("Tags"))
->url(url::site("admin/tags")));
}
+
+ static function item_index_data($item, $data) {
+ $data[] = join(" ", tag::item_tags($item));
+ }
}
diff --git a/modules/tag/helpers/tag_search.php b/modules/tag/helpers/tag_search.php
deleted file mode 100644
index 034b7af5..00000000
--- a/modules/tag/helpers/tag_search.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2009 Bharat Mediratta
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
- */
-class tag_search_Core {
- static function item_index_data($item) {
- return join(" ", tag::item_tags($item));
- }
-}