1 (edited by grwebguy 18-03-2015 19:32:34)

Topic: [ALPHA] Search Plugin v1.1

Early Alpha Nibbleblog Search Plugin.

https://github.com/billcreswell/nibbleblog_search

No guarantees.
Tested slightly.
May require a languages folder to operate but languages have not been implemented yet.

Re: [ALPHA] Search Plugin v1.1

Cool, great job.

Testing...

Re: [ALPHA] Search Plugin v1.1

Great ! I will test!

regards

Re: [ALPHA] Search Plugin v1.1

I noticed that it is blank for a quote post, which apparently has no title attribute?

Re: [ALPHA] Search Plugin v1.1

Hi,

I get this message on every search:

Warning: file_get_contents(content/public\.): failed to open stream: Permission denied in C:\xampp\htdocs\nibbleblog\plugins\search\plugin.bit on line 48

Any idea how can I fix it?

English isn't my native language. Sorry for any mistakes you may find.

Re: [ALPHA] Search Plugin v1.1

This needs to be updated, please smile

Re: [ALPHA] Search Plugin v1.1

Added a default title for posts without a title
https://github.com/billcreswell/nibbleblog_search

@xdsfhiftblue, if you have particulars that you'd like, be sure to mention them. I only did update this because you requested an update.

Re: [ALPHA] Search Plugin v1.1

Luigi wrote:

Hi,

I get this message on every search:

Warning: file_get_contents(content/public\.): failed to open stream: Permission denied in C:\xampp\htdocs\nibbleblog\plugins\search\plugin.bit on line 48

Any idea how can I fix it?


I had the same issue -- so I reviewed the code... line 48 contains...

            $source = file_get_contents( $file );

If $source is blank, then your generated $source will contain JUST the directory name; You cannot use file_get_contents() on a directory. 

To fix this I had to declare the $source variable before entering the loop, and then added a test to check if the filename is a directory with php function is_dir($file) -- problem solved!

Here's the code in action:

46:        $source = null;
47:
48:        foreach( $files as $k => $file ) {
49:            if(!is_dir( $file )) $source = file_get_contents( $file );

Re: [ALPHA] Search Plugin v1.1

Search results also includes DRAFT posts/pages ... In my case I don't want to see draft documents as these are work-in-progress/unfinished ... Thus, I've changed the code to also check that the filename isn't a draft document.

old code:

50:            if( stripos( $source, $str ) !== false ) {

new code:

50:            if( stripos( $source, $str ) !== false && strpos( $file, 'draft' ) == false ) {

Re: [ALPHA] Search Plugin v1.1

Thanks Schlumpfu!

If you are on github, feel free to fork/contribute directly!

https://github.com/billcreswell/nibbleb … es/tag/1.1
1.1
-Added empty language file
-Fix for file opening dir error (thanks Schlumpfuk)

Re: [ALPHA] Search Plugin v1.1

grwebguy wrote:

Thanks Schlumpfu!

If you are on github, feel free to fork/contribute directly!

https://github.com/billcreswell/nibbleb … es/tag/1.1
1.1
-Added empty language file
-Fix for file opening dir error (thanks Schlumpfuk)

Your welcome!