Submit changes to plugins

Creating and modifying plugins.
Post Reply
WebComPas
Regular
Posts: 101
Joined: Thu Nov 22, 2007 10:14 am
Contact:

Submit changes to plugins

Post by WebComPas »

Hello!

I just changed the freetag plugin and want to submit the changes. Unfortunately I couldn't find out how to do this. I hope someone can tell me, how this is possible.

Thank you!

Pascal
Interessantes aus den Themenbereichen Computer, Internet und Programmierung unter http://www.it-blog.net
kleinerChemiker
Regular
Posts: 765
Joined: Tue Oct 17, 2006 2:36 pm
Location: Vienna/Austria
Contact:

Re: Submit changes to plugins

Post by kleinerChemiker »

Just post the changes here or send Garvin a PM.
WebComPas
Regular
Posts: 101
Joined: Thu Nov 22, 2007 10:14 am
Contact:

Re: Submit changes to plugins

Post by WebComPas »

Thank you for this information. Followig you find the changes I made.

I changed the plugin concerning the keyword-to-tag feature. Now there is an option to select if this feature is active. So you can for example disable it temporarily.
Additionally I improved the way of searching for keywords. Up to now the plugin simply checks if the text contains the keyword strings even if they only are included in a word. Especially in German this often leads to false positives. I changed this by checking this with a regular expression. So (with some exceptions) keywords are only found when they are in the text as a single word.


My changes within the plugin files:

Code: Select all

// serendipity_event_freetag.php

// Changed:
$propbag->add('configuration', array('cat2tag', 'keyword2tag', 'taglink', 'embed_footer', 'extended_smarty', 'show_tagcloud', 'min_percent', 'max_percent', 'max_tags', 'use_flash', 'flash_tag_color', 'flash_bg_trans', 'flash_bg_color', 'flash_width', 'flash_speed', 'meta_keywords', 'show_related', 'show_related_count', 'lowercase_tags', 'send_http_header', 'admin_show_taglist', 'admin_ftayt', 'technorati_tag_link', 'technorati_tag_image'));

// Added:
case 'keyword2tag':
    $propbag->add('type',        'boolean');
    $propbag->add('name',        PLUGIN_EVENT_FREETAG_KEYWORD2TAG);
    $propbag->add('description', PLUGIN_EVENT_FREETAG_KEYWORD2TAG_DESC);
    $propbag->add('default',     false);
    break;

// Changed:
if (serendipity_db_bool($this->get_config('keyword2tag'))) {
    $searchtext = $eventData['body'] . $eventData['extended'];
    foreach($automatted AS $keyword => $ktags) {
        $keyword = trim($keyword);
        if (empty($keyword)) continue;
        if (!is_array($ktags) || count($ktags) < 1) continue;
        $regex = sprintf("/((\s+|[\(\[-]+)%s([-\/,\.\?!'\";\)\]]*+|[\/-]+))/i", $keyword);
        if (preg_match($regex, $searchtext) > 0) {
            foreach($ktags AS $tag => $is_assigned) {
                if (!is_array($tags) || (!in_array(strtolower($tag), $tags) && !in_array($tag, $tags))) {
                    if ($to_lower) {
                        if (function_exists("mb_strtolower")) {
                            $tag = mb_strtolower($tag);
                        } else {
                            $tag = strtolower($tag);
                        }
                    }

                    $tags[] = $tag;
                    printf(PLUGIN_EVENT_FREETAG_KEYWORDS_ADD, htmlspecialchars($keyword), htmlspecialchars($tag));
                }
            }
        }
    }
}

Code: Select all

// lang_en.inc.php

// Added:
@define('PLUGIN_EVENT_FREETAG_KEYWORD2TAG', 'Create tags from automatted keywords?');
@define('PLUGIN_EVENT_FREETAG_KEYWORD2TAG_DESC', 'If enabled, the entry will be checked if it contains any of the automatted keywords and the corresponding tags will be added. You can set the keywords within the "Manage Tags" menu of your Administration Suite.');

Code: Select all

// lang_de.inc.php

// Changed:
@define('PLUGIN_EVENT_FREETAG_CAT2TAG_DESC', 'Falls aktiviert, werden alle Kategorien eines Eintrags als Tags zugewiesen. Alle bestehende Kategoriezuweisungen können über die Tag-Verwaltung in Tags konvertiert werden.');

// Added:
@define('PLUGIN_EVENT_FREETAG_KEYWORD2TAG', 'Erstelle Tags durch automatische Schlüsselwörter?');
@define('PLUGIN_EVENT_FREETAG_KEYWORD2TAG_DESC', 'Falls aktiviert, wird der Eintrag daraufhin geprüft, ob darin automatische Schlüsselwörter enthalten sind. Gegebenenfalls werden die entsprechenden Tags zugewiesen. Die Schlüsselwörter können über die Tag-Verwaltung festgelegt werden.');
I hope that these changes will be added soon to the official plugin version. Thank you!

Regards,
Pascal
Interessantes aus den Themenbereichen Computer, Internet und Programmierung unter http://www.it-blog.net
Post Reply