Skip to content

Commit

Permalink
Renamed hook
Browse files Browse the repository at this point in the history
  • Loading branch information
annando committed Oct 1, 2023
1 parent e84a7e8 commit 0840086
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions doc/Addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ Please note: body contents are bbcode - not HTML
Called when receiving a post from another source. This may also be used to post local activity or system generated messages.
`$b` is the item array of information to be stored in the database and the item body is bbcode.

### get_language
### detect_languages
Called after the language detection. This can be used for alternative language detection methods.
`$data` is an array:

- **text**: The text that is analyzed.
- **detected**: The array with the original language detection. Can be overwritten via an addon.
- **detected**: (input/output) Array of language codes detected in the related text.

### addon_settings
Called when generating the HTML for the addon settings page.
Expand Down Expand Up @@ -807,7 +807,7 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-

### src/Model/Item.php

Hook::callAll('get_language', $item);
Hook::callAll('detect_languages', $item);
Hook::callAll('post_local', $item);
Hook::callAll('post_remote', $item);
Hook::callAll('post_local_end', $posted_item);
Expand Down
8 changes: 8 additions & 0 deletions doc/de/Addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ Derzeitige Hooks
$b ist das Item-Array einer Information, die in der Datenbank und im Item gespeichert ist.
{Bitte beachte: der Seiteninhalt ist bbcode - nicht HTML)

**'detect_languages'**
Wird nach der Sprachenerkennung aufgerufen.
Dieser Hook kann dafür verwendet werden, alternative Erkennungsfunktionen einzubinden.
`$data` ist ein Array:
'text' => Der analysierte Text.
'detected' => (Eingabe/Ausgabe) Das Array mit den erkannten Sprachen.

**'addon_settings'** - wird aufgerufen, wenn die HTML-Ausgabe der Addon-Einstellungsseite generiert wird.
$b ist die HTML-Ausgabe (String) der Addon-Einstellungsseite vor dem finalen "</form>"-Tag.

Expand Down Expand Up @@ -316,6 +323,7 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap

### src/Model/Item.php

Hook::callAll('detect_languages', $item);
Hook::callAll('post_local', $item);
Hook::callAll('post_remote', $item);
Hook::callAll('post_local_end', $posted_item);
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,7 @@ public static function getLanguageArray(string $body, int $count): array
'detected' => $languages,
];

Hook::callAll('get_language', $data);
Hook::callAll('detect_languages', $data);
$languages = $data['detected'];

return $languages;
Expand Down

0 comments on commit 0840086

Please sign in to comment.