Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Ionize Search module
=======================

Version : 1.0
Version : 1.1

Ionize version : 0.9.9
Ionize version : 1.0.2

Released on january 2013
Released on june 2013

### About

Search gives search capabilities to Ionize.
Search gives multilang search capabilities to Ionize.

This version of Search works only with Ionize from version 0.9.9
This version of Search works only with Ionize from version 1.0.2


### Authors
Expand All @@ -24,6 +24,14 @@ This version of Search works only with Ionize from version 0.9.9
* Copy the folder "Search" into the "/modules" folder of your Ionize installation.
* In the ionize backend, go to : Modules > Administration
* Click on "install"
* Create a view containing the tag `<ion:search:display />`
* Create a page called 'search', it's mandatory
* Translate title and url of this page to any language
* Add previous view to this page.

That's all.

To display a search form in other views, simply use the tag `<ion:search:form />`



Expand Down
7 changes: 0 additions & 7 deletions Search/config.xml

This file was deleted.

18 changes: 18 additions & 0 deletions Search/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$config['module']['search'] = array
(
'module' => "Search",
'name' => "Search Module",
'description' => "Search the content of the site",
'author' => "Partikule",
'version' => "1.1",

// to activate multilang searching, module don't use its url, so, anything is good except 'search'.
// Instead, module use a call to a page with id 'search' which can be translated to any language. It's mandatory !
'uri' => 'searching',
'has_admin'=> FALSE,
'has_frontend'=> FALSE,
);

return $config['module']['search'];
10 changes: 10 additions & 0 deletions Search/config/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>

<p>Directory access is forbidden.</p>

</body>
</html>
4 changes: 2 additions & 2 deletions Search/controllers/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Ionize Dev Team
* @license http://ionizecms.com/doc-license
* @link http://ionizecms.com
* @since Version 0.94
* @since Version 1.02
*/

// ------------------------------------------------------------------------
Expand All @@ -22,7 +22,7 @@
*/


class Search extends Base_Controller
class Search extends My_Module
{

// ------------------------------------------------------------------------
Expand Down
10 changes: 10 additions & 0 deletions Search/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>

<p>Directory access is forbidden.</p>

</body>
</html>
10 changes: 10 additions & 0 deletions Search/language/en/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>

<p>Directory access is forbidden.</p>

</body>
</html>
5 changes: 2 additions & 3 deletions Search/language/en/search_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@

$lang['module_search_input_label'] = 'Search';
$lang['module_search_button_start'] = 'Start searching';
$lang['module_search_message_no_results'] = 'No result found';
$lang['module_search_message_no_results'] = 'No result found with term ';
$lang['module_search_fill_the_field'] = 'Your searched term :';
$lang['module_search_results_title'] = 'Results for';
$lang['module_search_form'] = 'Search for...';

$lang['module_search_result_in'] = 'Result in: ';
$lang['module_search_read_complete_article'] = 'Read the article...';

$lang['module_search_read_complete_article'] = 'Read the article...';
10 changes: 10 additions & 0 deletions Search/language/fr/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>

<p>Directory access is forbidden.</p>

</body>
</html>
4 changes: 2 additions & 2 deletions Search/language/fr/search_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

$lang['module_search_input_label'] = 'Chercher';
$lang['module_search_button_start'] = 'Lancer la recherche';
$lang['module_search_message_no_results'] = 'Aucun résultat trouvé';
$lang['module_search_message_no_results'] = 'Aucun résultat trouvé avec le terme ';
$lang['module_search_fill_the_field'] = 'Saisissez le terme recherché';
$lang['module_search_results_title'] = 'Résultats pour : ';
$lang['module_search_form'] = 'Rechercher...';

$lang['module_search_result_in'] = 'Résultat dans : ';
$lang['module_search_read_complete_article'] = "Lire l'article...";
$lang['module_search_read_complete_article'] = "Lire l'article...";
2 changes: 1 addition & 1 deletion Search/language/ja/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</head>
<body>

<p>直接アクセス禁止</p>
<p>Directory access is forbidden.</p>

</body>
</html>
15 changes: 11 additions & 4 deletions Search/language/ja/search_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
|--------------------------------------------------------------------------
*/

$lang['module_search_button_start'] = '検索実行';
$lang['module_search_message_no_results'] = '一件も見つかりませんでした';
$lang['module_search_fill_the_field'] = '検索文字列 :';
$lang['module_search_results_title'] = '検索結果';
$lang['module_search_input_label'] = '検索';
$lang['module_search_button_start'] = '検索実行';
$lang['module_search_message_no_results'] = '一件も見つかりませんでした';
$lang['module_search_fill_the_field'] = '検索文字列 :';
$lang['module_search_results_title'] = '検索結果';


$lang['module_search_form'] = '検索...';

$lang['module_search_result_in'] = '結果: ';
$lang['module_search_read_complete_article'] = "記事を読む...";
10 changes: 10 additions & 0 deletions Search/language/tr/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>

<p>Directory access is forbidden.</p>

</body>
</html>
7 changes: 7 additions & 0 deletions Search/language/tr/search_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@
|--------------------------------------------------------------------------
*/


$lang['module_search_input_label'] = 'Arama';
$lang['module_search_button_start'] = 'Aramayı başlat';
$lang['module_search_message_no_results'] = 'Sonuç bulunamadı';
$lang['module_search_fill_the_field'] = 'Arama Terimleriniz :';
$lang['module_search_results_title'] = 'Sonuçlar';


$lang['module_search_form'] = 'Arama...';

$lang['module_search_result_in'] = 'Sonuçları: ';
$lang['module_search_read_complete_article'] = "Makaleyi okuyun ...";
43 changes: 36 additions & 7 deletions Search/libraries/tags.php → Search/libraries/search_tags.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author Ionize Dev Team
* @license http://ionizecms.com/doc-license
* @link http://ionizecms.com
* @since Version 0.9.5
* @since Version 1.02
*
*
*/
Expand All @@ -31,6 +31,7 @@ class Search_Tags extends TagManager
public static $tag_definitions = array
(
'search:form' => 'tag_search_form',
'search:display' => 'tag_search_display',
'search:results' => 'tag_search_results',
'search:realm' => 'tag_simple_value',
'search:results:result' => 'tag_expand',
Expand Down Expand Up @@ -91,6 +92,24 @@ public static function tag_search_form(FTL_Binding $tag)
}


// ------------------------------------------------------------------------


/**
* Display the results view
*
* @usage <ion:search:display />
*
*/
public static function tag_search_display(FTL_Binding $tag)
{
$tag->expand();

// the tag returns the content of this view :
return $tag->parse_as_nested(file_get_contents(MODPATH.'Search/views/search_result'.EXT));
}


// ------------------------------------------------------------------------


Expand Down Expand Up @@ -126,15 +145,25 @@ public static function tag_search_results(FTL_Binding $tag)
{
// arrays of keys, for multisorting
$knum = $kdate = array();
$unique = array();

foreach($articles as $key => &$article)
{
// set number of found words
preg_match_all('#'.$realm.'#i', $article['title'].' '.$article['content'], $match);
$num = count($match[0]);

$article['nb_words'] = $knum[$key] = $num;
$kdate[$key] = strtotime($article['date']);
// remove duplicates
if(!in_array($article['id_article'], $unique)) {
$unique[] = $article['id_article'];

// set number of found words
preg_match_all('#'.$realm.'#i', $article['title'].' '.$article['content'], $match);
$num = count($match[0]);

$article['nb_words'] = $knum[$key] = $num;
$kdate[$key] = strtotime($article['date']);

} else {
unset($articles[$key]);
}

}

// Sort the results by realm occurences DESC first, by date DESC second.
Expand Down
3 changes: 2 additions & 1 deletion Search/models/search_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Ionize Dev Team
* @license http://ionizecms.com/doc-license
* @link http://ionizecms.com
* @since Version 0.9.5
* @since Version 1.02
*/

// ------------------------------------------------------------------------
Expand Down Expand Up @@ -47,6 +47,7 @@ function get_articles($realm)

$lang = Settings::get_lang();


// Page_Article table
$this->{$this->db_group}->select($this->parent_table.'.*', FALSE);
$this->{$this->db_group}->join(
Expand Down
8 changes: 2 additions & 6 deletions Search/views/search_form.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@

<!-- Search module's form -->
<form method="post" action="">

<input id="search-input" type="text" name="realm" value="" />

<input type="submit" value="<ion:translation term="module_search_button_start" />" />

<form method="post" action="<ion:page:url id='search' />">
<input id="search-input" type="text" name="realm" value="" placeholder="<ion:lang key="module_search_form" />" />
</form>
Loading