Have it working. This is what I did:
Hack to cp.publish.php in order to pass weblog_id
// -------------------------------------------
// 'publish_form_headers' hook.
// - Adds content to headers for Publish page.
//
// PHB passed weblog_id
$DSP->extra_header .= $EXT->call_extension('publish_form_headers', $which, $submission_error, $entry_id,$weblog_id);
if ($EXT->end_script === TRUE) return;
//
// -------------------------------------------
Filter for this weblogs fields in ext.xinha.php
// -------------------------------
// Add JavaScript Header
// -------------------------------
function add_header($which,$errors,$entry_id,$weblog_id)
{
global $PREFS,$DB;
// get list of fields in this weblog
$sql="SELECT concat('field_id_',field_id) as fieldname
FROM exp_weblogs ,exp_weblog_fields
WHERE exp_weblogs.field_group = exp_weblog_fields.group_id AND
field_type='textarea' AND
weblog_id=".$weblog_id;
$query=$DB->query($sql);
$PossibleFields=array();
foreach($query->result as $row) {
$PossibleFields[]=$row['fieldname'];
}
$FieldsToUse = array();
$FieldsToUse = array_intersect($PossibleFields,$this->settings['Text_Fields_To_Use_With_Xinha']);
// print_r($this->settings['Text_Fields_To_Use_With_Xinha']); // this is what I use to see the array's contents during testing
$r = '
And use this filtered field to output to page header:
/** STEP 2 ***************************************************************
* Set which fields will get Xinha
************************************************************************/
xinha_editors = xinha_editors ? xinha_editors :
[ ';
$this->OutputArrayAsDoubleQuoteDelimitedList($FieldsToUse, &$r);
$r = $r . '
];