Topic Closed

I want to the search into special link html output.

Out of the box plugin output was not include into the gpeasy search function.

I've play arround with the search hook:

Addon_Name = 'Test'    

Addon_Unique_ID = 676

Addon_Version = 0.4

min_gpeasy_version = 1.5RC2

;A description about your addon,
; may contain some html: <div>,<p>,<a>,<b>,<br/>,<span>,<tt>,<em>,<i>,<b>,<sup>,<sub>,<strong>,<u>
About = 'Test';

[Special_Link:ELMA diag system]
label = 'System diag'
script = 'system.php'
;class = 'Configuration'

[Special_Link:ELMA diag rsyslog]
label = 'rsyslog diag'
script = 'rsyslog.php'
;class = 'Configuration'

script = 'Search.php'
class = 'DiagSearch'

My tries with search.php:

<?php defined('is_running') or die('Not an entry point...');

class DiagSearch{
    function DiagSearch($args){

        $search_obj = $args[0];

        $PluginFile = '/srv/www/htdocs/elma/addons/ELMA Diagnostics/system.php';

        $diagtitle = "Diagnostics";

            $diaglabel = common::GetLabel($diagtitle);
            $diagcontent = ob_get_clean();

            $search_obj->FindString($diagcontent, $diaglabel, $diaglink);


This finds the search pattern, but in case of not matching search pattern it is also in hit list.

Is there a more dynamic way to address all defined special link inside a plugin?

Any help would be fine.


8 years ago#7115

263 Posts
1 Themes
8 Plugins

$diagcontent = ob_get_clean();

Now $diagcontent contains the gpEasy buffer content which itself contains the html code echo-ed by the special_gpsearch::Search() method including the search string.

This explains why your content is always returned in the search results whether it matches the search pattern or not.

I don't know what is the content of your system.php file but assuming it echo-es your plugin html content, adding an ob_start(); instruction just before the include should do the trick.

$diagcontent = ob_get_clean();


Edited: 8 years ago#7116

This procedure works fine if in plugin code is no class defined.

But if there are classes the content value becomes empty.

I've tested with Plugins_Examples:

;Map Example
label = 'Example_Map'
script = '01_Map.php'
class = 'Example_Map'

;Ajax Example
label = 'Example_Ajax'
script = '02_Ajax.php'
class = 'Example_Ajax'

script = 'Search.php'
class = 'Example_Search'



defined('is_running') or die('Not an entry point...');

class Example_Search {

    function PluginSearchContent($File){

        if( file_exists($File) ){
echo $File."<br>";
            $Content = ob_get_clean();
        return $Content;

    function Example_Search($args){

        global $addonPathCode;
        $search_obj = $args[0];

        $Label = "Example_Map";
        $File = $addonPathCode.'/01_Map.php';
        $search_obj->FindString($this->PluginSearchContent($File), $Label, $Link);

        $Label = "Example_Ajax";
        $File = $addonPathCode.'/02_Ajax.php';
        $search_obj->FindString($this->PluginSearchContent($File), $Label, $Link);



8 years ago#7120

263 Posts
1 Themes
8 Plugins

Have a look at the Search.php file shipped with Simple_Blog.

It's a good example of how a plugin can be integrated within the gpeasy search feature.

8 years ago#7136

Topic Closed



elFinder 2.1.50 in Upcoming Release

A new release for Typesetter is in the works with a lot of improvements including the ... Read More

Typesetter 5.1

Typesetter 5.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Ennetb├╝rgen (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Websi...

Find out more about our Provider Spotlight

Log In