<commit_before><?php

$events = array();

$e = array(
    'OnMODXInit',
    'OnHandleRequest',
    'pdoToolsOnFenomInit',
);

foreach ($e as $ev) {
    $events[$ev] = $modx->newObject('modPluginEvent');
    $events[$ev]->fromArray(array(
        'event' => $ev,
        'priority' => 0,
        'propertyset' => 0
    ),'',true,true);
}

return $events;

<commit_msg>Lower OnHandleRequest priority to 1 when packaged, to work reliably out of the box with context router plugins.<commit_after><?php

$events = array();

$e = array(
    'OnMODXInit',
    'OnHandleRequest',
    'pdoToolsOnFenomInit',
);

foreach ($e as $ev) {
    $events[$ev] = $modx->newObject('modPluginEvent');
    $events[$ev]->fromArray(array(
        'event' => $ev,
        // Lower OnHandleRequest priority to 1, to work reliably out of the box with context router plugins.
        'priority' => $ev === 'OnHandleRequest' ? 1 : 0, 
        'propertyset' => 0
    ),'',true,true);
}

return $events;


{'fraction_non_alphanumeric': 0.1704312114989733, 'fraction_numerical': 0.007186858316221766, 'mean_word_length': 3.239130434782609, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1993387', 'n_tokens_mistral': 340, 'n_tokens_neox': 329, 'n_words': 84}